ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   working with a group of sheets (https://www.excelbanter.com/excel-programming/372089-working-group-sheets.html)

GKeramidas

working with a group of sheets
 
how would you do this without selecting? or by using the index number 1-3
instead of the sheet names?

Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
With Range("m28")
..Value = "test"
..Font.Bold = True
End With

--


Gary



Bob Phillips

working with a group of sheets
 
Sheets(Array(Worksheets(1).Name, Worksheets(2).Name,
Worksheets(3).Name)).Select
With Range("m28")
..Value = "test"
..Font.Bold = True
End With


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"GKeramidas" wrote in message
...
how would you do this without selecting? or by using the index number 1-3
instead of the sheet names?

Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
With Range("m28")
.Value = "test"
.Font.Bold = True
End With

--


Gary





GKeramidas

working with a group of sheets
 
thanks for the reply bob.
2 things

this doesn't put the value test into all 3 sheets, only the active one.
also, is there way to enter a value into all 3 sheets without selecting?

--


Gary


"Bob Phillips" wrote in message
...
Sheets(Array(Worksheets(1).Name, Worksheets(2).Name,
Worksheets(3).Name)).Select
With Range("m28")
.Value = "test"
.Font.Bold = True
End With


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"GKeramidas" wrote in message
...
how would you do this without selecting? or by using the index number
1-3
instead of the sheet names?

Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
With Range("m28")
.Value = "test"
.Font.Bold = True
End With

--


Gary






Bob Phillips

working with a group of sheets
 
Sorry Gary, this works

Dim i As Long

For i = 1 To 3
With Worksheets(i).Range("M28")
.Value = "test"
.Font.Bold = True
End With
Next i


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"GKeramidas" wrote in message
...
thanks for the reply bob.
2 things

this doesn't put the value test into all 3 sheets, only the active one.
also, is there way to enter a value into all 3 sheets without selecting?

--


Gary


"Bob Phillips" wrote in message
...
Sheets(Array(Worksheets(1).Name, Worksheets(2).Name,
Worksheets(3).Name)).Select
With Range("m28")
.Value = "test"
.Font.Bold = True
End With


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"GKeramidas" wrote in message
...
how would you do this without selecting? or by using the index number
1-3
instead of the sheet names?

Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
With Range("m28")
.Value = "test"
.Font.Bold = True
End With

--


Gary








GKeramidas

working with a group of sheets
 
hi bob:

that's what i am using, just thought there might be a way to do it all at
once.

thanks
--


Gary


"Bob Phillips" wrote in message
...
Sorry Gary, this works

Dim i As Long

For i = 1 To 3
With Worksheets(i).Range("M28")
.Value = "test"
.Font.Bold = True
End With
Next i


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"GKeramidas" wrote in message
...
thanks for the reply bob.
2 things

this doesn't put the value test into all 3 sheets, only the active one.
also, is there way to enter a value into all 3 sheets without selecting?

--


Gary


"Bob Phillips" wrote in message
...
Sheets(Array(Worksheets(1).Name, Worksheets(2).Name,
Worksheets(3).Name)).Select
With Range("m28")
.Value = "test"
.Font.Bold = True
End With


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"GKeramidas" wrote in message
...
how would you do this without selecting? or by using the index number
1-3
instead of the sheet names?

Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
With Range("m28")
.Value = "test"
.Font.Bold = True
End With

--


Gary










All times are GMT +1. The time now is 09:21 AM.

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