|
-
Mar 22nd, 2005, 10:28 AM
#1
Thread Starter
New Member
VB script in Excel using Forms
Ok, it's been a long time since my college classes on vb scripting, so I'm hoping for a point in the right direction.
In an Excel spreadsheet, on one tab, I have a list of about 200 servers and how they appear on racks in our datacenter. It's a rough visual map of the center. On another tab I have all the information regarding each server.
Is there a way to click on a server name, or a button next to it if that's what I have to use, and in so doing have a text box populate with information from the second tab regarding that server? I know how to do a simple vlookup to find that information, but how do I script it so that by clicking in the cell, or a button, it populates a text box with that info?
Sorry if this is a bit confusing, or even if it's a bit too much for someone as rusty as myself. But any help is MUCH MUCH MUCH appreciated.
-
Mar 22nd, 2005, 02:08 PM
#2
Re: VB script in Excel using Forms
Welcome to the Forums.
Two options,
1.) Create hyperlinks on the server names to link to the second sheet.
2.) Use VBA to populate a textbox on your sheet1 with the specs from sheet2.
I think #1 is easier. 
VB Code:
'Behind Sheet1
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Only act on cells in the first column "A"
If ActiveCell.Column = 1 Then
If ActiveCell.Hyperlinks.Count = 0 Then
ActiveCell.Hyperlinks.Add ActiveCell, Sheet2.Cells(ActiveCell.Row, 1)
End If
'ActiveCell.Hyperlinks.Item(1).Follow False 'Isnt working on my system?
Sheet2.Activate
Sheet2.Cells(ActiveCell.Row, 1).Activate
End If
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 23rd, 2005, 12:22 AM
#3
Thread Starter
New Member
Re: VB script in Excel using Forms
RobDog, you rock! Your code didn't work perfectly (never does, does it?), but I think it got me going in the right direction. Thanks man!
-
Mar 23rd, 2005, 01:36 AM
#4
Re: VB script in Excel using Forms
Thanks! You know we all have an "off-day" once in a while. 
If this ends up not working out good enough, just drop a thread in here and I will try to help out more.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|