Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have created the code to copy some cells from another workbook. It works fine, but same code, if I copy and use it for another worksheet, it gives me error "subscript out of range"
Here is the code that works Sub IllTaxReturn( ' IllTaxReturn Macr ' Macro recorded 05/28/2004 by KPAWA Dim x As Varian Dim y As Varian Dim z As Varian Workbooks("Mar-2004.xls").Sheets("Mar-04").Cells(86, 5).Copy Sheets("IllTaxReturn").Cells(14, 4 y = Workbooks("Mar-2004.xls").Sheets("Mar-04").Cells(86, 7).Valu Sheets("IllTaxReturn").Cells(19, 4) = Workbooks("Mar-04.xls").Sheets("Mar-04").Cells(23, 2).Copy Sheets("IllTaxReturn").Cells(23, 4 x = Workbooks("Mar-2004.xls").Sheets("Mar-04").Cells(34, 5).Valu Sheets("IllTaxReturn").Cells(90, 4) = z = Workbooks("Mar-2004.xls").Sheets("Mar-04").Cells(34, 7).Valu Sheets("IllTaxReturn").Cells(95, 4) = End Su Here is the code that doesn't Sub ALTaxReturn( ' Alabama TaxReturn Macr ' Macro recorded 05/28/2004 by KPAWA Dim x As Varian Dim y As Varian 'Dim z As Varian Workbooks("Mar-2004.xls").Sheets("Mar-04").Cells(9, 5).Copy Sheets("ALTaxReturn").Cells(14, 4 'x = Workbooks("Mar-2004.xls").Sheets("Mar-04").Cells(9, 5).Valu 'Sheets("ALTaxReturn").Cells(14, 4) = y = Workbooks("Mar-2004.xls").Sheets("Mar-04").Cells(9, 7).Valu Sheets("ALTaxReturn").Cells(19, 4) = Workbooks("Mar-04.xls").Sheets("Mar-04").Cells(10, 2).Copy Sheets("ALTaxReturn").Cells(23, 4 End Su It gives me error on very first line, which is very similar to previous code Thank |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
using a cell value to control a counter inside a macro and displaying macro value | Excel Worksheet Functions | |||
macro to delete entire rows when column A is blank ...a quick macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |