Nitecon
02-17-2011, 01:18 AM
Hey guys I'm new here and a DBA, and I'm trying to get an example for excel. I'm extremely new to VB so I would love to get an example to learn / work from. Here is my situation. I have 3 work sheets in my excel workbook. Main Sheet, Alias Sheet and Phone Sheet. All sheets have a common column called username. Main sheet contains almost 25 thousand rows, so I want to use a MessageBox to ask the user which column they want to search (username) and what to match it to, in this case Alias Sheet Column C(also entered in message box by the user)
So once that is done it starts a foreach loop on the main sheet, and basically copies A1 searches for A1 in Alias Sheet (C1:ENDOFCOL) If it finds a matching username it then copies MessageBox number 3's column from the Alias sheet, to Message box post location.
So to try clarify it a bit. The user will in total be asked for 4 inputs
Main Search column (A)
Alias Search Column (C)
Alias Copy Column (E)
Main Paste Column (H)
Then the macro will search every cell in Column A of the Main Sheet, and try to find a match to a row in the alias sheet's Column C. If a match is found, then Copy Column E of the Alias sheet to The Main sheet's Column H
I know this may be a bit complicated, but it will really help me out a huge amount, as it is the tip of the iceberg on what I want to use the end result of the macro for, although it's complicated it will be a great help for me to learn the scripting language as well.
For other DBA's I basically want to do a SQL Join on Table 1 col 1 where it is equal to Table 2 Col 3. And then use the result set to pate the 5th element of the query into column H.
Any and all help will be hugely appreciated.
Thanks guys!
So once that is done it starts a foreach loop on the main sheet, and basically copies A1 searches for A1 in Alias Sheet (C1:ENDOFCOL) If it finds a matching username it then copies MessageBox number 3's column from the Alias sheet, to Message box post location.
So to try clarify it a bit. The user will in total be asked for 4 inputs
Main Search column (A)
Alias Search Column (C)
Alias Copy Column (E)
Main Paste Column (H)
Then the macro will search every cell in Column A of the Main Sheet, and try to find a match to a row in the alias sheet's Column C. If a match is found, then Copy Column E of the Alias sheet to The Main sheet's Column H
I know this may be a bit complicated, but it will really help me out a huge amount, as it is the tip of the iceberg on what I want to use the end result of the macro for, although it's complicated it will be a great help for me to learn the scripting language as well.
For other DBA's I basically want to do a SQL Join on Table 1 col 1 where it is equal to Table 2 Col 3. And then use the result set to pate the 5th element of the query into column H.
Any and all help will be hugely appreciated.
Thanks guys!