Macro not running properly on change in cell value

M

Monk

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
 
A

Ariel Dugan

Hi,

I think you just need to capitalize the "c" in your range address.

I tried it that way and it works.

Thanks
Ariel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top