ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Write to One Worksheet Only ? (https://www.excelbanter.com/excel-programming/330110-write-one-worksheet-only.html)

MAS

Write to One Worksheet Only ?
 
Hi,

I use this code to write a time into A1 ;
Range("A1").Value = Format(RunWhen,"hh:mm:ss")
Rather than have it write it to A1 in whatever is the active sheet, how do i
change it so it always writes to A1 in the first sheet in the workbook. The
name of the worksheet changes day by day so i can't just tell it the name of
the worksheet?





Chip Pearson

Write to One Worksheet Only ?
 
If you always want the first sheet, use

Worksheets(1).Range("A1").Value = Format(RunWhen,"hh:mm:ss")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"MAS" wrote in message
...
Hi,

I use this code to write a time into A1 ;
Range("A1").Value = Format(RunWhen,"hh:mm:ss")
Rather than have it write it to A1 in whatever is the active
sheet, how do i change it so it always writes to A1 in the
first sheet in the workbook. The name of the worksheet changes
day by day so i can't just tell it the name of the worksheet?








All times are GMT +1. The time now is 05:26 PM.

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