Avatar of Dale Logan
Dale Logan
Flag for United States of America asked on

Excel VBA trying to loop through rows in a named range

Experts,

When you see my file, you will know right away that I am clueless when it comes to using VBA in Excel.

I created a macro that goes out to a website and looks up a small amount of data for one golfer. Now I am trying to figure out how to do this for all golfers in a table. If I could figure out how to loop through all users I would then have to figure out to have the data pasted below the previous golfers data. The data for each golfer should span 3 rows. So, I need to be able to go down 3 or 4 rows before pasting the next golfer.

Thanks, Dale

Handicaps.xlsm
Microsoft ExcelVBA

Avatar of undefined
Last Comment
Martin Liss

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Martin Liss

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Dale Logan

ASKER
Ok, I think I've added that part correctly, but can't be sure until I get everything else fixed.

Each time the loop runs I need a url inserted. The only thing different each time is the value in the third column of the named range needs to be inserted in the middle.

Here's how I am trying to do that:

Dim String1 As String
Dim String2 As String

String1 = "URL;http://widgets.ghin.com/HandicapLookupResults.aspx?entry=1&dynamic=&small=0&css=default&ghinno="
String2 = "hidename=0&showmsg=0&showheader=1&showtabheader=0&combinehieff=0&showheadertext=1&showfootertext=1&tab=2"


String1&rngRow.Columns(3).Value&String2

Open in new window

Martin Liss

That should work. (I know the rngRow.Columns(3) part is correct)
Dale Logan

ASKER
I must not be putting the url string together correctly. I get the attached error message in the attached section.
Capture3Capture4
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
SOLUTION
Martin Liss

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Dale Logan

ASKER
Wow. It looks like we are really close. The only thing left to figure out is to have the loop drop down 3 cells each time through. Currently it is overwriting the previous loops results each time. I have a line in there that says: Destination:=Range("$A$1")). How would I make it drop down 3 cells each time?
Dale Logan

ASKER
Got it figured out. Thanks so much for your help.
Martin Liss

You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2015
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.