How to get sheet from sheet name
If you use Sheet3.Cells(1, 1) that means that you are using the codename
(the VBA name if you like), not the Excel name. As such it will not change
just by inserting new sheets, only if you change it in the VBIDE or by code.
You could always set a sheet variable
Dim sh As Worksheet
Set sh = Worksheets("Sheet3")
and then refer to sh later on.
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
wrote in message
ps.com...
Hi everyone
I am using Sheet3.Cells(1, 1) to get some value from Sheet3 but Sheet3
can change if i insert new sheets . So is there any function that
retruns worksheet if i provides the sheet name.
so instead of using
varaible = Sheet3.Cells(attRow, attCol)
i can use
Dim sheet , varaible
sheet = unknowFunciton("data sheet") ' "data sheet" is the name
of Sheet3
varaible = sheet.Cells(1, 1)
Regards
Amaninder Saini :)
|