ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Using arrays to select a series of cells (https://www.excelbanter.com/excel-discussion-misc-queries/61994-using-arrays-select-series-cells.html)

[email protected]

Using arrays to select a series of cells
 
I'm trying to use a macro called from Worksheet_Activate that selects
cell a1, then runs a macro to resize the cell, then selects a2 ... this
continues for 5 or 6 cells
I'm having problems selecting the cells, I don't know how to define
them.
I have so far:

Private Sub Worksheet_Activate()
Dim i As Integer
For i = 1 To 10
?????????
(my macro runs here)
next i
End Sub

Any help is greatly appreciated.
Thanks,
Rounder


Dave Peterson

Using arrays to select a series of cells
 
Does resize mean change the columnwidth or rowheight?

If yes...

Option Explicit

Private Sub Worksheet_Activate()
Dim myCell As Range
For Each myCell In Me.Range("a1:a10").Cells
myCell.RowHeight = 33
'myCell.ColumnWidth = 12
Next myCell
End Sub

You don't usually have to select a range/cell to work with it.


wrote:

I'm trying to use a macro called from Worksheet_Activate that selects
cell a1, then runs a macro to resize the cell, then selects a2 ... this
continues for 5 or 6 cells
I'm having problems selecting the cells, I don't know how to define
them.
I have so far:

Private Sub Worksheet_Activate()
Dim i As Integer
For i = 1 To 10
?????????
(my macro runs here)
next i
End Sub

Any help is greatly appreciated.
Thanks,
Rounder


--

Dave Peterson


All times are GMT +1. The time now is 12:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com