LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Loops & Ifs

Hello,
I have made a worksheet to download the data shown below. Now I am
faced with what I can only see as the almost impossible task of
creating a macro, which will go through the data. For each row, from
column E to P I want to insert a URL on the same row starting from
column Y. if the cell = abnd I don't want to insert the URL and if
the cell is empty I don't want to insert a URL. Here is the data im
getting;


ROW C D E F G H I J K L M N O P
Count 1 2 3 4 5 6 7 8 9 10 11 12
12 BR 8 Abnd Abnd Abnd 7,1,10 11,3,5 5,1,4 F4 Abnd Abnd
13 MR 7 3,1,6 6,4,9 7,1,10 6,1,4 7,F4 11,3,5 3,2,7
14 NR 5 2,8,9 5,1,9 2,9,4 2,4,5 2,8,4
15 VR 5 2,5,3 8,6,9 2,4,8 5,4,3 5,1,4 F4
16 CR 7 14,13,10 1,2,3 6,11,7 9,3,1 12,3,5 5,1,4 11,5,3
17

Here is the code I have somehow managed to make!! I think its overly
complicated but it works! Unless there is a gap in the data it still
creates a URL AND if the cell is Abnd it still creates the URL. I
don't know where to insert the code to stop this!!

Sub CalculateURLs()

Dim columnI As Integer
Dim rowI As Integer
Dim numberOfRacesI As Integer
Dim numberOfRaces As Integer
Dim raceCode As String
Dim todaysDate As String
Dim lastRaceURL As String
Dim startRaceCount As Integer
todaysDate = Range("A2")
Sheets("Imported Data").Select
rowI = 9
columnI = 5
startRaceCount = 1

Do
Range("C" & rowI).Select
If ActiveCell = IsEmpty("C" & rowI) Then
rowI = rowI + 1
Else
Range("D" & rowI).Select
If ActiveCell = IsEmpty("D" & rowI) Then
If ActiveCell = Range("S" & rowI) Then
rowI = rowI + 1
Else
End If

Else
raceCode = Range("C" & rowI)
numberOfRaces = Range("D" & rowI)
numberOfRacesI = 1
startRaceCount = 1
ActiveCell.Offset(0, 1).Select
If ActiveCell = "" Then
Do
ActiveCell.Offset(0, 1).Select
columnI = columnI + 1
startRaceCount = startRaceCount + 1
Loop While ActiveCell = ""
End If
If ActiveCell = "" Then
Else
Range("Y" & rowI).Select
columnI = 25
Do
If startRaceCount <= 9 Then
lastRaceURL = "URL;http://www.getdata.com/" &
todaysDate & "/" & raceCode & "0" & startRaceCount & ".html"
Else
lastRaceURL = "URL;http://www.getdata.com/" &
todaysDate & "/" & raceCode & startRaceCount & ".html"
End If
ActiveCell = lastRaceURL
startRaceCount = startRaceCount + 1
numberOfRacesI = numberOfRacesI + 1
columnI = columnI + 1
ActiveSheet.Cells(rowI, columnI).Select
Loop Until numberOfRacesI numberOfRaces
rowI = rowI + 1
columnI = 25
startRaceCount = 0
End If
End If
End If
Range("A" & rowI + 1).Select
Loop Until ActiveCell = "Last Race Results"

End Sub




Any help would be greatly appreciated! Sorry I cant explain it any
better than this, just give me a shout if you need any more info!
Thanks,
Shorty

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Loops fugfug[_2_] Excel Programming 3 July 8th 05 10:53 AM
Do loops within Do loops Linking to specific cells in pivot table Excel Programming 4 April 14th 05 08:47 AM
Using For - Next Loops in VB Biomed New Users to Excel 4 March 22nd 05 07:12 PM
Loops Snow[_2_] Excel Programming 2 May 13th 04 09:48 PM
help with loops Rick B[_6_] Excel Programming 8 January 28th 04 12:32 AM


All times are GMT +1. The time now is 11:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"