Need To Cycle Through Range ("F2-F800")

drmingle

Board Regular
Joined
Oct 5, 2009
Messages
229
The below code snippet only handles one value for one cell:

Code:
StrURI = Range("F2")

In the same column ("F") I have 800 values that I need to cycle through.
Any help would be appreicated...
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Something like

Rich (BB code):
Dim c As Range, StrURI As String
 
For Each c In Range("F2:F800")
    StrURI = c.Value
    'Do something with StrURI
Next c
 
Upvote 0
The below code snippet only handles one value for one cell:

Code:
StrURI = Range("F2")

In the same column ("F") I have 800 values that I need to cycle through.
Any help would be appreicated...

For larger data manipulation you may want to go one step further and use a variant array rather than a range. It offers a performance gain over ranges if your code is taking a notably long time to run

1. Set up the range of interest (F2:F800)
2. Create a variant array (X) from the range
3. Loop through each record in the variant array and so something (in this example, make everything upper case)
4. Dump the array back over the initial range

Cheers

Dave

Code:
Sub ArrayWrite()
    Dim rng1 As Range
    Dim X
    Dim lngRow As Long
    Set rng1 = Range([f2], [f800])
    X = rng1
    For lngRow = 1 To UBound(X)
        X(lngRow, 1) = UCase$(X(lngRow, 1))
    Next
    rng1 = X
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,833
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top