Moving files from a MAC to windows excel 2007

mummbles74

Board Regular
Joined
Nov 14, 2009
Messages
120
Office Version
  1. 365
Platform
  1. Windows
I have only ever done code on a mac before and wrote this code for an Invoice generation program. I am now using a windows laptop and can't seem to get it to work. Can anyone see any issues?

Sub Create_invoice()

Dim wb As Workbook
Dim wb2 As Workbook

counter = Range("B26") + 1



Workbooks("create invoice.xls").Activate
Range("a2:a10").Select
Selection.Copy
Workbooks("blank invoice.xls").Activate
Range("a10").Select
Selection.PasteSpecial paste:=xlValues
Application.CutCopyMode = False
Workbooks("create invoice.xls").Activate
Range("a13:a23").Select
Selection.Copy
Workbooks("blank invoice.xls").Activate
Range("a20").Select
Selection.PasteSpecial paste:=xlValues
Application.CutCopyMode = False
Workbooks("create invoice.xls").Activate
Range("e13:e23").Select
Selection.Copy
Workbooks("blank invoice.xls").Activate
Range("g20").Select
Selection.PasteSpecial paste:=xlValues
Application.CutCopyMode = False
Range("g8").Select
Selection = counter

'Workbooks("create invoice.xls").Activate
'Range("b26").Select
'Selection = counter
Workbooks("blank invoice.xls").SaveAs Filename:="invoice " & Range("g8").Value & ""
'ActiveWorkbook.PrintOut Copies:=1, Collate:=True
'ActiveWorkbook.SaveAs "C:\Any Folder\" & Range("A1").Value & ".xls"
answer = MsgBox("Do you want to print ?", vbYesNo)
If answer = vbYes Then Print_sheet
If answer = vbNo Then
End If
Workbooks("create invoice.xls").Activate
Range("b26").Select
Selection = counter

End Sub

Appreciate the help in advance
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Well the first thing I can think of is - why are you using Excel/VBA in the first place?

If you want to transfer files aren't there other ways.:)
 
Upvote 0
Sorry. I must not of explained what I meant properly. The files are all on the same computer. I was using a mac but I am now using a windows machine with excel 2007. The vba is for generating an invoice I put a few details in the create invoice file and it opens the file blank invoice creates the invoice gives them an incrementing invoice number and saves it as that number. Hope that makes it clearer. Appreciate the help.
 
Upvote 0
In what way specifically does it not work?
 
Upvote 0
Error 9 is a subscript out of range error which, based on your code, is most likely due to a workbook name being incorrect. Did you save the file with an extension other than 'xls' for example?
 
Upvote 0
Thanks for all your help again I have managed to find the problem. I had to add a line in at the top of the code to tell it to open the second workbook first. Something that you don't have to do on the mac. Note to self.
 
Upvote 0

Forum statistics

Threads
1,225,482
Messages
6,185,259
Members
453,283
Latest member
Shortm88

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