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:
Range("C2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Range("D2").Select
ActiveSheet.Paste
Selection.Replace What:="am", Replacement:=" AM", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="pm", Replacement:=" PM", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False The highlighted code is where the macro hangs. Can anyone help? Thank you.

<colgroup><col width="469" style="width: 352pt; mso-width-source: userset; mso-width-alt: 17152;"> <tbody>
</tbody>
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
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.
Range("G2").Select
Range(Selection, Selection.End(xlDown)).Select
Se lection.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 Can you help with this? Thanks again.

<colgroup><col width="595" style="width: 446pt; mso-width-source: userset; mso-width-alt: 19040;"> <tbody>
</tbody>
 
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,216,105
Messages
6,128,859
Members
449,472
Latest member
ebc9

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