LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
oms oms is offline
external usenet poster
 
Posts: 3
Default Worksheet_Change - initiate macro on another worksheet

I am trying to get excel to automatically run a macro based off a change in
any cell in a column. I've been trying worksheet_change but have not had
much luck.

Objective:
If there is a change to any of the cells in column G of Sheet 1 (cell
contains a formula that works off other cells), I want the macro to sort data
on Sheet 2 (info that I linked from Sheet 1). I am unhiding and hiding a
column in Sheet 2 because it contains the value that I'm sorting by but I
don't want it to show in the final product.

I've attached the code below. Thanks in advance.

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("G3:G110")) Is Nothing Then

Application.EnableEvents = False
Application.ScreenUpdating = False
On Error Resume Next

Sheets("Sheet 2").Select

'Unhide Column C
Columns("B:D").Select
Selection.EntireColumn.Hidden = False

'Sort based on Column C value
Range("C2").Select
Range("A1:C50").Sort Key1:=Range("C2"), Order1:=xlDescending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

'Hide Column C
Columns("C:C").Select
Selection.EntireColumn.Hidden = True

End If

Application.EnableEvents = True
Application.ScreenUpdating = True
On Error GoTo 0

Sheets("Sheet 1").Select

End Sub
 
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
Call Worksheet_Change macro in another worksheet Freddy Excel Programming 6 October 29th 06 07:16 PM
How do I initiate a macro directly in a worksheet? AMMPro Excel Programming 3 July 15th 06 11:02 PM
Initiate Macro On Save JTWood Excel Programming 2 June 14th 06 03:47 PM
Macro to initiate a spreadsheet to email Rich F[_2_] Excel Programming 2 November 12th 04 07:00 PM


All times are GMT +1. The time now is 09:05 PM.

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

About Us

"It's about Microsoft Excel"