Hi Guru
I created one sheet in my excel file, and I created a customized bar as “NEW BAR”. In the customized bar, there are 5 buttons. One of them is called “ScrollRight1Screens”, underneath function as:
Sub ScrollRight1Screens()
Worksheets("sheet1".Activate
ActiveWindow.SmallScroll ToRight:=10
End Sub
Now I create another sheet, called “sheet2”. What I want is when I choose “sheet1”, using “ScrollRight1Screens” button, sheet1 is scrolled right. When I choose “ sheet2”, using the same button and same function. My question is how can I know which sheet I chose (or which one is activate) using VBA for the same function? I don’t want when I click the button, both of worksheet moving, which I achieved before:
Sub ScrollRight1Screens()
Worksheets("sheet1".Activate
ActiveWindow.SmallScroll ToRight:=10
Worksheets("sheet2".Activate
ActiveWindow.SmallScroll ToRight:=10
End Sub
If anyone can help me, I am very appreciated.
Cathy
I created one sheet in my excel file, and I created a customized bar as “NEW BAR”. In the customized bar, there are 5 buttons. One of them is called “ScrollRight1Screens”, underneath function as:
Sub ScrollRight1Screens()
Worksheets("sheet1".Activate
ActiveWindow.SmallScroll ToRight:=10
End Sub
Now I create another sheet, called “sheet2”. What I want is when I choose “sheet1”, using “ScrollRight1Screens” button, sheet1 is scrolled right. When I choose “ sheet2”, using the same button and same function. My question is how can I know which sheet I chose (or which one is activate) using VBA for the same function? I don’t want when I click the button, both of worksheet moving, which I achieved before:
Sub ScrollRight1Screens()
Worksheets("sheet1".Activate
ActiveWindow.SmallScroll ToRight:=10
Worksheets("sheet2".Activate
ActiveWindow.SmallScroll ToRight:=10
End Sub
If anyone can help me, I am very appreciated.
Cathy