Hello
I'm a newbe, so please bear with me.
I'm having problems doing the following in VBA for Excel
A first piece of VBA script in an active Excel worksheet accesses an external DB and fills columns E from row 10 onwards with social security numbers. So far so good
A second piece of VBA script is supposed to get the first entry in the social security column (>E10) and use that value in a VBA macro that contains a sql command. The aim is for SQL to get to a second external DB and extract name and address for the person belonging to the social security number.
Name and number are to be put in column C and D of the same row the social security number was taken from.
Then the VBA script is to proceed to the next row in column E and do it all over again for the second social security number. And so on until there are no more numbers in column E.
If I put the social security number in the SQL string as an exact numerical value (like 1234567) it works. I don't now how to refer to sucessive rows in column E however.
Some stuff I'm using
Dim client As String
Dim Name As String
Const column_Client As String = "C"
Const Column_Name As String = "D"
' Column E is define as follows
Dim RgSocialSec As Range
Set RgSocialSec = Range("E10:E3000").Select
Really stuck with this
Many thanks for any help
Welcome to the forum. Please note ...
Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
That said, try changing:
Set RgSocialSec = Range("E10:E3000").Select
to just:
Set RgSocialSec = Range("E10:E3000")
Regards, TMS
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks