PC Code not working on MAC

cmhoz

Active Member
Joined
Aug 20, 2006
Messages
268
I am using this code to auto populate a date field

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("E19:E52")) Is Nothing Then
With Target(1, -1)
.Value = Date
.EntireColumn.AutoFit
End With
End If
End Sub

What it does: when I put data into any cell in the E19:E52 range, it places todays date into the corresponding row in column C.

I first wrote this code for a file at work (on a Windows PC) and it works like a dream... no problems. I copied & pasted the code to use for a file at home (on a MAC running OS X) and it just doesn't work. Fails everytime.

Any MAC people out there have a clue what the coding difference is???
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Damon Ostrander

MrExcel MVP
Joined
Feb 17, 2002
Messages
4,239
Hi cmhoz,

I suspect the problem is with line

With Target(1, -1)

and suggest you replace it with

With Target.Offset(0,-2)


Damon
 

Forum statistics

Threads
1,137,367
Messages
5,681,075
Members
419,950
Latest member
BeckiJae

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
Top