Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro not running properly on change in cell value
Hi
I am attempting to run a macro when the value of a drop down field changes. The macro, Refresh1, is detailed below and it works fine if I run it via Tools/Macro/Macro/Run. Sub Refresh1() Application.ScreenUpdating = False Application.Calculation = xlManual ActiveSheet.ShowAllData Range("A4:B2000").AdvancedFilter Action:=xlFilterInPlace, Unique:=True Application.Run "HideBlankRows" Range("C1").Select Application.Calculation = xlAutomatic Application.ScreenUpdating = True End Sub However it does not operate when the macro is run via a change in the drop down field. The code is below. It appears that the Show All Data and HideBlankRows commands are not working. Any suggestions to clarify my error would be appreciated. Thanks Monk Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$c$1" Then Refresh1 End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro not running properly on change in cell value
Hi,
I think you just need to capitalize the "c" in your range address. I tried it that way and it works. Thanks Ariel "Monk" wrote in message ... Hi I am attempting to run a macro when the value of a drop down field changes. The macro, Refresh1, is detailed below and it works fine if I run it via Tools/Macro/Macro/Run. Sub Refresh1() Application.ScreenUpdating = False Application.Calculation = xlManual ActiveSheet.ShowAllData Range("A4:B2000").AdvancedFilter Action:=xlFilterInPlace, Unique:=True Application.Run "HideBlankRows" Range("C1").Select Application.Calculation = xlAutomatic Application.ScreenUpdating = True End Sub However it does not operate when the macro is run via a change in the drop down field. The code is below. It appears that the Show All Data and HideBlankRows commands are not working. Any suggestions to clarify my error would be appreciated. Thanks Monk Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$c$1" Then Refresh1 End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro not running properly on change in cell value
Thanks Ariel. Didn't realise it was that fussy!!. Cheers
"Ariel Dugan" wrote: Hi, I think you just need to capitalize the "c" in your range address. I tried it that way and it works. Thanks Ariel "Monk" wrote in message ... Hi I am attempting to run a macro when the value of a drop down field changes. The macro, Refresh1, is detailed below and it works fine if I run it via Tools/Macro/Macro/Run. Sub Refresh1() Application.ScreenUpdating = False Application.Calculation = xlManual ActiveSheet.ShowAllData Range("A4:B2000").AdvancedFilter Action:=xlFilterInPlace, Unique:=True Application.Run "HideBlankRows" Range("C1").Select Application.Calculation = xlAutomatic Application.ScreenUpdating = True End Sub However it does not operate when the macro is run via a change in the drop down field. The code is below. It appears that the Show All Data and HideBlankRows commands are not working. Any suggestions to clarify my error would be appreciated. Thanks Monk Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$c$1" Then Refresh1 End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Why this isn't running properly (excel macro) Pls help!! | Excel Programming | |||
Shortcut key not running macro properly | Excel Discussion (Misc queries) | |||
Macro not running properly when shortcut is used | Excel Programming | |||
Running a macro on cell value change | Excel Discussion (Misc queries) | |||
Running a macro on cell value change | Excel Discussion (Misc queries) |