Macro Code on MAC Computer

Leonardo

Board Regular
Joined
Nov 8, 2011
Messages
57
I am not a macro coder or a MAC user. It is my wife's MAC. I can edit the VB code a bit but that is about it. I am using an excel sheet with recorded macros on a MAC computer. The macros were recorded on a PC and I have run a similar spreadsheet on the MAC with no problem. The macro has been updated a bit since it was last run on the mac but the instruction that is hanging things up is one that has run before. It is a search and replace instruction and what is being searched for and replaced has changed slightly but not significantly. See code below:[TABLE="width: 352"]
<colgroup><col width="469" style="width: 352pt; mso-width-source: userset; mso-width-alt: 17152;"> <tbody>[TR]
[TD="width: 469, bgcolor: transparent"] Range("C2").Select[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"] Range(Selection, Selection.End(xlDown)).Select[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"] Selection.Copy[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"] Range("D2").Select[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"] ActiveSheet.Paste[/TD]
[/TR]
[TR]
[TD="class: xl63, bgcolor: yellow"] Selection.Replace What:="am", Replacement:=" AM", LookAt:=xlPart, _[/TD]
[/TR]
[TR]
[TD="class: xl63, bgcolor: yellow"] SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _[/TD]
[/TR]
[TR]
[TD="class: xl63, bgcolor: yellow"] ReplaceFormat:=False[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"] Selection.Replace What:="pm", Replacement:=" PM", LookAt:=xlPart, _[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"] SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"] ReplaceFormat:=False The highlighted code is where the macro hangs. Can anyone help? Thank you.[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Mac VBA doesn't have the last two arguments. You need to use just:
Code:
Selection.Replace What:="am", Replacement:=" AM", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
 
Upvote 0
Mac VBA doesn't have the last two arguments. You need to use just:
Code:
Selection.Replace What:="am", Replacement:=" AM", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Thank you very much. That got me past that error, but I encountered another. I suspect this might happen until I get through to the end of the macro. This is the next section where I am encountering an error.[TABLE="width: 446"]
<colgroup><col width="595" style="width: 446pt; mso-width-source: userset; mso-width-alt: 19040;"> <tbody>[TR]
[TD="width: 595, bgcolor: transparent"] Range("G2").Select[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"] Range(Selection, Selection.End(xlDown)).Select[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"] Se lection.TextToColumns Destination:=Range("G2"), DataType:=xlDelimited, _[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"] TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"] Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"] :="-", FieldInfo:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True Can you help with this? Thanks again. [/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Rory I did not see the requirement for posting code until after I posted the second message and I tried to edit the message but the 10 minute window had expired. I clicked the administrator link which opened a message window, but I clicked away to copy the code and when I returned the message window had disappeared. I no longer see my message. should I repost the entire message with the proper code tags? Thank you.
 
Upvote 0
I am re-posting this message to comply with the requirements for including Macro code in a message. I am not a macro coder or a MAC user. It is my wife's MAC that I am using. I can edit VB code a bit but that is about it. I am using an excel sheet with recorded macros on a MAC computer. The macros were recorded on a PC and I have run a similar spreadsheet on the MAC with no problem. See code below:
This is the next section where I am encountering an error.

Code:
Range("G2").Select
Range(Selection,  Selection.End(xlDown)).Select
Selection.TextToColumns Destination:=Range("G2"),  DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote,  ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False,  Comma:=False, Space:=False, Other:=True, OtherChar _
:="-",  FieldInfo:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True

Is there anyone online who can help me with this?

Thanks you.
 
Last edited by a moderator:
Upvote 0

Forum statistics

Threads
1,223,240
Messages
6,170,951
Members
452,368
Latest member
jayp2104

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