select same column across multiple sheets

omairhe

Well-known Member
Joined
Mar 26, 2009
Messages
2,040
Office Version
  1. 2019
Platform
  1. Windows
Hey everyone.

What VBA code can take me to the same column as my current worksheet column I am working on. For instance, I am at column D of my Active worksheet. So if I type in "Enter". The Enter key pressed on Column D should make the Column D the active column in all other sheets. Point to be noted here is I do not want the rows to be disturbed. Meaning if in other sheets the rows were at C2, E6 and F10 prior pressing the Enter key, I want these to be D2, D6 and D10 respectively.


Would it be possible?

Thanks and much appreciation.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Try placing the following sub in ThisWorkbook code section:
Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Source As Range)
    Dim ws As Worksheet
    Application.ScreenUpdating = False
    For Each ws In Sheets
        ws.Select
        Cells(ActiveCell.Row, Source.Column).Select
    Next
    Sh.Select
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Try placing the following sub in ThisWorkbook code section:
Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Source As Range)
    Dim ws As Worksheet
    Application.ScreenUpdating = False
    For Each ws In Sheets
        ws.Select
        Cells(ActiveCell.Row, Source.Column).Select
    Next
    Sh.Select
    Application.ScreenUpdating = True
End Sub


Sorry to bug u but please also note that along with what your code does, which is phenomenon, it must also have the scrolling position set for the column as same as the active worksheet.
For instance I change the value in cell AH3 and press Enter. The code takes over from here and selects AH for the rest of the sheets, but I can't view the column unless I press an arrow key first, because it doesn't automatically scroll to the selected cell or keep the same scroll as the original sheet.
 
Last edited:
Upvote 0
Here is a modified sub for you to try:
Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Source As Range)
    Dim ws As Worksheet, c As Long
    c = ActiveWindow.VisibleRange.Column
    Application.ScreenUpdating = False
    For Each ws In Sheets
        ws.Select
        Cells(ActiveCell.Row, Source.Column).Select
        ActiveWindow.SmallScroll ToLeft:=Columns.Count
        ActiveWindow.SmallScroll ToRight:=c - 1
    Next
    Sh.Select
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Here is a modified sub for you to try:
Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Source As Range)
    Dim ws As Worksheet, c As Long
    c = ActiveWindow.VisibleRange.Column
    Application.ScreenUpdating = False
    For Each ws In Sheets
        ws.Select
        Cells(ActiveCell.Row, Source.Column).Select
        ActiveWindow.SmallScroll ToLeft:=Columns.Count
        ActiveWindow.SmallScroll ToRight:=c - 1
    Next
    Sh.Select
    Application.ScreenUpdating = True
End Sub

Perfect. I am satisfied with this one.
Thank you.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,335
Members
452,636
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top