Re: macro OK in Excel 2003 but NOT in Excel 2000
- From: "Peter T" <peter_t@discussions>
- Date: Fri, 15 Feb 2008 10:22:02 -0000
I don't see anything wrong in your code that would fail due to version.
However your code would fail if the active*** is not a work***, eg it's
a chart-*** or no visible ***. Just in case, it might be worth the two
changes to the commented line below -
With Sheets("sheet1")
' Set rngFrom = .Range(.Range("A1"), .Cells(Rows.Count, "A").End(xlUp))
Set rngFrom = .Range(.Range("A1"), .Cells(.Rows.Count, 1).End(xlUp))
Regards,
Peter T
"AncientLearner" <AncientLearner@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F8E605CE-6D94-427C-BEA9-939709697350@xxxxxxxxxxxxxxxx
I can run to following code in Excel 2003 but when I run it in Excel 2000I
get an error/debug at the line >> Set rngFrom = <<<<<
Should I declare different variables because of 2000 version?
****
Sub ADP_ExportExcel()
'transpose horizontal column output (multiCol) into single column
(vertical)
Dim rngFrom As Range
Dim rngTo As Range
Dim rng As Range
With Sheets("sheet1")
Set rngFrom = .Range(.Range("A1"), .Cells(Rows.Count, "A").End(xlUp))
End With
Set rngTo = Sheets("sheet2").Range("A1")
For Each rng In rngFrom
rngTo.Value = rng.Value
rngTo.Offset(1, 0).Value = rng.Offset(0, 1).Value '2 columns
rngTo.Offset(2, 0).Value = rng.Offset(0, 2).Value '3 columns
rngTo.Offset(3, 0).Value = rng.Offset(0, 3).Value '4 columns
Set rngTo = rngTo.Offset(4, 0) 'number of rows per item
Next rng
End Sub
--
AncientLearner
...never to old to learn something new
.
- Follow-Ups:
- Re: macro OK in Excel 2003 but NOT in Excel 2000
- From: AncientLearner
- Re: macro OK in Excel 2003 but NOT in Excel 2000
- Prev by Date: RE: Issue with workbook not being selected when form button is cli
- Next by Date: Columns to rows
- Previous by thread: Re: macro OK in Excel 2003 but NOT in Excel 2000
- Next by thread: Re: macro OK in Excel 2003 but NOT in Excel 2000
- Index(es):