Simple problem, must be too early...
The Select method is failing below, not sure what I am doing wrong. My goal
is to synchronize the selection across several sheets. I am using "SelectionChange" event to fire little code below. Thanks in advance for help. Public rwSelect as integer Sub Sync_Sheets() Dim rng As Range rwSelect = Selection.Row Set rng = Sheets(2).Range("C" & rwSelect) rng.Select Sheets(14).Activate End Sub |
Simple problem, must be too early...
You have to select or activate a sheet to change its selection.
Sub Sync_Sheets() Dim mySht As Worksheet Dim rwSelect As Long rwSelect = Selection.Cells(1).Row Application.ScreenUpdating = False For Each mySht In Worksheets mySht.Select Range("C" & rwSelect).Select Next mySht Sheets(14).Activate Application.ScreenUpdating = True End Sub HTH, Bernie MS Excel MVP "AD108" wrote in message ... The Select method is failing below, not sure what I am doing wrong. My goal is to synchronize the selection across several sheets. I am using "SelectionChange" event to fire little code below. Thanks in advance for help. Public rwSelect as integer Sub Sync_Sheets() Dim rng As Range rwSelect = Selection.Row Set rng = Sheets(2).Range("C" & rwSelect) rng.Select Sheets(14).Activate End Sub |
Simple problem, must be too early...
Oops. I overlooked your use of the selection change event: Use
Application.EnableEvents = False and Application.EnableEvents = True to bracket your code.... HTH, Bernie MS Excel MVP "AD108" wrote in message ... The Select method is failing below, not sure what I am doing wrong. My goal is to synchronize the selection across several sheets. I am using "SelectionChange" event to fire little code below. Thanks in advance for help. Public rwSelect as integer Sub Sync_Sheets() Dim rng As Range rwSelect = Selection.Row Set rng = Sheets(2).Range("C" & rwSelect) rng.Select Sheets(14).Activate End Sub |
Simple problem, must be too early...
Make sure Sheets(20 is Active when you hit
rng.Select -- Gary''s Student gsnu200709 "AD108" wrote: The Select method is failing below, not sure what I am doing wrong. My goal is to synchronize the selection across several sheets. I am using "SelectionChange" event to fire little code below. Thanks in advance for help. Public rwSelect as integer Sub Sync_Sheets() Dim rng As Range rwSelect = Selection.Row Set rng = Sheets(2).Range("C" & rwSelect) rng.Select Sheets(14).Activate End Sub |
All times are GMT +1. The time now is 03:11 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com