Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Good day,
I have a function in a module, in which I would like to state that the current visible worksheet should be treated as the active one, because I do not know during execution what the sheet name will be. In the example below the sheet name is hardcoded, what is the better solution? With ActiveWorkbook With .Worksheets("Titans") .Range("M5").Value = 5 End With End With Kind regards George |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi George,
Dim SH As Worksheet Set SH = ActiveSheet SH.range("M5").Value = 5 The object variable SH will refer to the stipulated sheet, irrespective of whether it is subsequently active or not.. --- Regards, Norman "George Furnell" wrote in message ... Good day, I have a function in a module, in which I would like to state that the current visible worksheet should be treated as the active one, because I do not know during execution what the sheet name will be. In the example below the sheet name is hardcoded, what is the better solution? With ActiveWorkbook With .Worksheets("Titans") .Range("M5").Value = 5 End With End With Kind regards George |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Populate current active cell - Help Please!! | Excel Worksheet Functions | |||
HOW DO I REVERT SCROLL BOX TO CURRENT VISIBLE WINDOW? | Excel Discussion (Misc queries) | |||
Identify current active cell | Excel Worksheet Functions | |||
How to make sure a Cell is within the current visible window's ran | Excel Programming | |||
Worksheet has to set to visible as it is not visible after saving and closing Excel by VB. | Excel Programming |