![]() |
HELP! Copy/Paste Macro Works on PC But Not Mac!
A very helpful person gave me the following code last night on this forum:
Sub CopyRow() Dim Msg As String If ActiveSheet.Name = "Status" Then Msg = "You must first select a cell in the row you want to copy on the other sheet. " MsgBox Msg, vbExclamation, "Alert" Exit Sub Else Application.ScreenUpdating = False Cells(ActiveCell.Row, 1) = Now ActiveCell.EntireRow.Copy Worksheets("Status").Rows(5).Insert Application.CutCopyMode = False Application.ScreenUpdating = True End If End Sub It puts a time/date stamp in the first column of the row with the active cell, copies the whole row to the clipboard, inserts a fresh row at row 5 of the sheet called "Status," and then pastes the row in to the newly-inserted row. It works really, really well on my PC at home, but I've discovered it doesn't on the Macs one of our departments at work uses. The code runs--it doesn't error out--but nothing is pasted in at the end. Nothing in the code or workbook is at all different from last night. Does anyone have any ideas? |
HELP! Copy/Paste Macro Works on PC But Not Mac!
(vba code) "... works really, really well on my PC at home, but I've discovered it doesn't on the Macs one of our departments at work uses." '-- Office 2008 (mac) does not have/use VBA. Microsoft removed it. News (maybe noise) now from MS is that the next mac office version will have VBA restored. -- Jim Cone Portland, Oregon USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) |
HELP! Copy/Paste Macro Works on PC But Not Mac!
Oh, hi, Jim. You were actually the kindly perosn from last night, as you must
know--I just didn't want to bother you with something that seems like a stupid Mac issue. Anyway--I wish that were it, but the production department that uses Macs is still running Office for Mac 2004. We've run into odd VBA incompatibility issues before (I think VBA for Mac is still several years behind the PC version), but this one just has me stumped. I mean, I've checked each of the methods, properties, etc. in the help screen here, and nothing seems illegal in Macworld. Sigh. I'm wondering if not actually using a paste method anywhere is a sort of shorthand that's OK in the PC definition of copy but not in the Mac. In fact [2-minute pause while I check something] I just noticed that the status bar at the bottom of the window stil shows "Please select destination and press enter," etc. etc., so I wonder if that IS it. Oh, well. If you have any ideas, that would be great, but you've already been more than generous. Thanks again for your insight! "Jim Cone" wrote: (vba code) "... works really, really well on my PC at home, but I've discovered it doesn't on the Macs one of our departments at work uses." '-- Office 2008 (mac) does not have/use VBA. Microsoft removed it. News (maybe noise) now from MS is that the next mac office version will have VBA restored. -- Jim Cone Portland, Oregon USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) |
HELP! Copy/Paste Macro Works on PC But Not Mac!
There is a public.excel.macintosh newsgroup but the message volume is very low - last post (unanswered) on May 9th. You could try posting there and hope. I just ran the code in XL97. It has the same VB version as a mac. It ran without a hitch. As an experiment, I modified the code to paste the row as a separate operation instead of relying only on the insert operation. In addition, I added an error handler and qualified all of the range callouts. It's worth a try... '-- Sub CopyRowR1() On Error GoTo RowYourBoat Dim Msg As String Dim cellRow As Long Dim startWorksheet As Excel.Worksheet Set startWorksheet = ActiveSheet cellRow = ActiveCell.Row If startWorksheet.Name = "Status" Then Msg = "You must first select a cell in the row you want to copy on the other sheet. " MsgBox Msg, vbExclamation, "Alert" Else Application.ScreenUpdating = False Worksheets("Status").Rows(5).Insert Shift:=xlShiftDown startWorksheet.Cells(cellRow, 1).Value = Now startWorksheet.Rows(cellRow).Copy Destination:=Worksheets("Status").Rows(5) Application.CutCopyMode = False Application.ScreenUpdating = True End If Set startWorksheet = Nothing Exit Sub RowYourBoat: MsgBox "Error " And Err.Number & vbCr & Err.Description End Sub -- Jim Cone Portland, Oregon USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) "Wart" wrote in message Oh, hi, Jim. You were actually the kindly perosn from last night, as you must know--I just didn't want to bother you with something that seems like a stupid Mac issue. Anyway--I wish that were it, but the production department that uses Macs is still running Office for Mac 2004. We've run into odd VBA incompatibility issues before (I think VBA for Mac is still several years behind the PC version), but this one just has me stumped. I mean, I've checked each of the methods, properties, etc. in the help screen here, and nothing seems illegal in Macworld. Sigh. I'm wondering if not actually using a paste method anywhere is a sort of shorthand that's OK in the PC definition of copy but not in the Mac. In fact [2-minute pause while I check something] I just noticed that the status bar at the bottom of the window stil shows "Please select destination and press enter," etc. etc., so I wonder if that IS it. Oh, well. If you have any ideas, that would be great, but you've already been more than generous. Thanks again for your insight! |
HELP! Copy/Paste Macro Works on PC But Not Mac!
Correction:
MsgBox "Error " And Err.Number & vbCr & Err.Description -should be- MsgBox "Error " & Err.Number & vbCr & Err.Description '-- Jim Cone |
All times are GMT +1. The time now is 12:22 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com