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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA - Excel - HeLp!!! 1

Status
Not open for further replies.

rosibee

Programmer
Jul 2, 2001
8
0
0
GB
Hiyas ALL!

I would be very grateful if someone or some people could help me with a VBA prob! Basically, I would like to know how to populate more than on cell in an Excel spreadsheet. I know how to populate a combo box and an individual cell but I don't know how to populate a series of cells like in a grid formation. Any help will be much appreciated!

Thanks well in advance

rosi X-)
 
The following code populates a 5x5 grid with the values
1 to 25.

For x = 1 To 5
For y = 1 To 5
counter = counter + 1
Range("'Sheet1'!A1").Offset(x - 1, y - 1).Value = counter
Next y
Next x

Also, Tek-Tips has a VBA Forum.

- vbMax
 
Hiyas vbMax,

Thanks! I didn't look or realise there was a forum for VBA but that's just down to my temporary blindness (too much lunch in the afternoon!!).

Anyway, I wanted to ask you or anyone else do I have to activate the sheet eventhough I am already in the excel?

e.g. sheet1.activate (something like that??)

Many Thanks again

rosi
X-)
 
As long as you specify the sheet name, such as:
Range("'Sheet1'!A1"), you do not have to activate the
sheet.

- vbMax
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top