sswcharlie
New Member
Hi
I am setting a variable etc. The loc1 is a dynamic named range, storing integers starting at G5 there is a changing total number of entries in it.
Another Macro will have to get the value in each row and then use it in a subroutine
I am setting a variable etc. The loc1 is a dynamic named range, storing integers starting at G5 there is a changing total number of entries in it.
Another Macro will have to get the value in each row and then use it in a subroutine
Code:
Sub CheckingVariable
Dim LastRow As Long
Dim i As Long
Dim vegetables 'variable changes as per each row
vegetables = integer
LastRow = Range("loc1" & Rows.Count).End(xlUp)
vegetables = 0 ' initialise starting value. Does this need to be done?
Range("loc1").Value = vegetables
MsgBox (" " & vegetables) ' to check to see if correct number is shown for each row
For i = 1 To LastRow
Next i
End Sub
[/CODE}
What I am trying to do is use a loop to check each row until end of list, and the number in the variable may change as it proceeds down the list.
With the 'Dynamic Named Range' loc1 it shows up as an error, do I have to declare it, but should the macro find it anyway?
In the For i = 1 To LastRow the 1 shows up as an error?
Comments would be appreciated.
Charles