ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   vba select same cell across all worksheets (https://www.excelbanter.com/excel-programming/303143-vba-select-same-cell-across-all-worksheets.html)

tcnolan

vba select same cell across all worksheets
 
Hi...

I am trying, in vba, to select one cell across all the sheets in a
workbook and Copy/Paste Special values.

Can anyone help with the code to select the same cell in all the
worksheets? The sheetnames will not always be the same.

Thank you,

Terry

Ron de Bruin

vba select same cell across all worksheets
 
One way

Sub test()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
sh.Range("B1").Value = sh.Range("B1").Value
Next
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"tcnolan" wrote in message om...
Hi...

I am trying, in vba, to select one cell across all the sheets in a
workbook and Copy/Paste Special values.

Can anyone help with the code to select the same cell in all the
worksheets? The sheetnames will not always be the same.

Thank you,

Terry




Terry Nolan

vba select same cell across all worksheets
 
Hi Ron,

Thanks so much...that worked perfectly.

Terry



*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 10:51 AM.

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