ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   ATTN: Mr. Bob Phillips (https://www.excelbanter.com/excel-worksheet-functions/42170-attn-mr-bob-phillips.html)

Danny

ATTN: Mr. Bob Phillips
 
I got your macro command a long time ago to change the cell pointer. I pasted
it in "ThisWorkbook" on my Personal worksheet. The Macro works when you put
the code in a worksheet. Can you please modify the code so if I copy it in my
Personal worksheet, it will work everytime I open a new workbook?
Thanks a lot.

Public OldRng
Private Sub Workbook_Open()
ReDim OldRng(20) 'allow for up to 20 worksheets
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
Dim ThisRng
On Error Resume Next
Set ThisRng = OldRng
If Not ThisRng Is Nothing Then
ThisRng.Interior.ColorIndex = xlNone
End If
Target.Interior.ColorIndex = 6 'yellow
Set OldRng = Target
End Sub


Michael

Hi Danny
Instead of pasting the Macro in "This Workbook"
put it in "All Open Workbooks"

HTH
Michael Mitchelson


"Danny" wrote:

I got your macro command a long time ago to change the cell pointer. I pasted
it in "ThisWorkbook" on my Personal worksheet. The Macro works when you put
the code in a worksheet. Can you please modify the code so if I copy it in my
Personal worksheet, it will work everytime I open a new workbook?
Thanks a lot.

Public OldRng
Private Sub Workbook_Open()
ReDim OldRng(20) 'allow for up to 20 worksheets
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
Dim ThisRng
On Error Resume Next
Set ThisRng = OldRng
If Not ThisRng Is Nothing Then
ThisRng.Interior.ColorIndex = xlNone
End If
Target.Interior.ColorIndex = 6 'yellow
Set OldRng = Target
End Sub



All times are GMT +1. The time now is 04:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com