D
Diddy
Hi,
I'm a bit of a dabbler with VBA, I use a combination of recorded code,
snippets from the web and user groups and (thankfully) code supplied in
answers here.
At the moment I'm trying to learn a bit about referring to ranges as I'm
hoping to use Offset in some work. The site I'm looking at is
http://spreadsheetpage.com/index.php/tip/referring_to_ranges_in_your_vba_code/
I'm totally confused about variables and DIM statements but understand the
reasons for using Option Explicit (I hope).
So my problem is that I've copied a bit of code from the website and don't
know how to dim the variables. I could spend all day trying various different
things but I was hoping that if I came here I could get some help and maybe
someone could explain the why of it too.
Here's the code
Sub FillRange2()
Num = 1
For Row = 0 To 9
For Col = 0 To 9
Sheets("Sheet1").Range("A1").Offset(Row,Col).Value = Num
Num = Num + 1
Next Col
Next Row
End Sub
Many thanks
I'm a bit of a dabbler with VBA, I use a combination of recorded code,
snippets from the web and user groups and (thankfully) code supplied in
answers here.
At the moment I'm trying to learn a bit about referring to ranges as I'm
hoping to use Offset in some work. The site I'm looking at is
http://spreadsheetpage.com/index.php/tip/referring_to_ranges_in_your_vba_code/
I'm totally confused about variables and DIM statements but understand the
reasons for using Option Explicit (I hope).
So my problem is that I've copied a bit of code from the website and don't
know how to dim the variables. I could spend all day trying various different
things but I was hoping that if I came here I could get some help and maybe
someone could explain the why of it too.
Here's the code
Sub FillRange2()
Num = 1
For Row = 0 To 9
For Col = 0 To 9
Sheets("Sheet1").Range("A1").Offset(Row,Col).Value = Num
Num = Num + 1
Next Col
Next Row
End Sub
Many thanks