Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving down a row inside a loop query 1

Status
Not open for further replies.

Schnappa

Technical User
Jul 27, 2003
58
AU
Hello

This is my first day using VBA. I have searched the web and tried to come up with a single usable answer for my query. I am running Excel 2007 on an XP machine.

I am trying to produce a large data input from a third part website, and am working through it stages - this one has got me. My code is attached.

I am trying to move the cursor in the DestSheet down one in readiness for the next loop. I have tried several ways, with the latest being shown.

Any help woul dbe appreciated.

Thanks

GV

Sub UNITABInput()
Dim Count As Integer
Dim Races As Integer
Dim DestSheet As Worksheet
Dim SourceSheet As Worksheet
Set DestSheet = Worksheets("HTML Creator")
Set SourceSheet = ActiveSheet
Races = Worksheets("Race Details Entry").Range("C4").Value
For Count = 1 To Races
DestSheet.Range("A1") = " & Worksheets("Race Details Entry").Range("C17").Value & "/" & Worksheets("Race Details Entry").Range("D17").Value & "/" & Worksheets("Race Details Entry").Range("E17").Value & "/" & Count & ".html"
DestSheet.ActiveCell.Offset(1, 0).Select --> This is the problem
Count = Count + 1
Next Count
MsgBox Count - 1
End Sub
 
Hi All

Managed to get some answers to this one.

Cheers

GV
 
Hi,

I recommend avoiding the use of the Select & Activate methods...
Code:
    For Count = 1 To Races
        DestSheet.Cells(Count, "A") = _
            "[URL unfurl="true"]http://www.awebsitename/"[/URL] & _
            Worksheets("Race Details Entry").Range("C17").Value & "/" & _
            Worksheets("Race Details Entry").Range("D17").Value & "/" & _
            Worksheets("Race Details Entry").Range("E17").Value & "/" & _
            Count & ".html"
    Next Count


Skip,
[sub]
[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top