Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why this isn't running properly (excel macro) Pls help!! Jay Excel Programming 3 January 20th 09 08:28 AM
Shortcut key not running macro properly Ted M H Excel Discussion (Misc queries) 5 October 1st 08 11:07 PM
Macro not running properly when shortcut is used Aviashn Excel Programming 2 June 4th 08 08:07 PM
Running a macro on cell value change Mike Excel Discussion (Misc queries) 0 March 28th 07 01:13 AM
Running a macro on cell value change Brettjg Excel Discussion (Misc queries) 0 March 28th 07 12:08 AM


All times are GMT +1. The time now is 07:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"