Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro is not working
I'm getting this error Run Time error '91' Object variable or with block
variable not set. When I hover the cursor over shtFixD.CodeName - I get shtFixD.CodeName = 'shtFixD' - which is correct When I hover the cursor over UpdateSht - I get UpdateSht = nothing - which is the problem Sub testrange() Dim UpdateSht As Worksheet Select Case shtInput.Range("RiskT").Value Case Is = "Fixed" UpdateSht = shtFixD.CodeName Case Else UpdateSht = shtVarD.CodeName End Select UpdateSht.Range("C16").EntireRow.Hidden = True End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro is not working
UpdateSht is a worksheet and must be set using the Set keyword.
Not sure why CodeName is in use, can you not use the internal sheet, e.g.: Dim UpdateSht As Worksheet Select Case shtInput.Range("RiskT").Value Case "Fixed" Set UpdateSht = shtFixD Case Else Set UpdateSht = shtVarD End Select -- Tim Zych www.higherdata.com Compare data in Excel and find differences with Workbook Compare A free, powerful, flexible Excel utility "Brad" wrote in message ... I'm getting this error Run Time error '91' Object variable or with block variable not set. When I hover the cursor over shtFixD.CodeName - I get shtFixD.CodeName = 'shtFixD' - which is correct When I hover the cursor over UpdateSht - I get UpdateSht = nothing - which is the problem Sub testrange() Dim UpdateSht As Worksheet Select Case shtInput.Range("RiskT").Value Case Is = "Fixed" UpdateSht = shtFixD.CodeName Case Else UpdateSht = shtVarD.CodeName End Select UpdateSht.Range("C16").EntireRow.Hidden = True End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro is not working
Thank you.
-- Wag more, bark less "Tim Zych" wrote: UpdateSht is a worksheet and must be set using the Set keyword. Not sure why CodeName is in use, can you not use the internal sheet, e.g.: Dim UpdateSht As Worksheet Select Case shtInput.Range("RiskT").Value Case "Fixed" Set UpdateSht = shtFixD Case Else Set UpdateSht = shtVarD End Select -- Tim Zych www.higherdata.com Compare data in Excel and find differences with Workbook Compare A free, powerful, flexible Excel utility "Brad" wrote in message ... I'm getting this error Run Time error '91' Object variable or with block variable not set. When I hover the cursor over shtFixD.CodeName - I get shtFixD.CodeName = 'shtFixD' - which is correct When I hover the cursor over UpdateSht - I get UpdateSht = nothing - which is the problem Sub testrange() Dim UpdateSht As Worksheet Select Case shtInput.Range("RiskT").Value Case Is = "Fixed" UpdateSht = shtFixD.CodeName Case Else UpdateSht = shtVarD.CodeName End Select UpdateSht.Range("C16").EntireRow.Hidden = True End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro that isn't working | Excel Discussion (Misc queries) | |||
macro not working | Excel Discussion (Misc queries) | |||
macro was working, now it's not working | Excel Programming | |||
Macro working in Excel 2003; not working in Excel 2000 | Excel Programming | |||
Macro not working | Excel Programming |