Cutting and pasting 90+ columns into 1 column
Closed
beladrian
-
Jun 25, 2009 at 11:01 PM
Excelguru Posts 261 Registration date Saturday April 11, 2009 Status Member Last seen June 21, 2011 - Aug 29, 2009 at 04:34 AM
Excelguru Posts 261 Registration date Saturday April 11, 2009 Status Member Last seen June 21, 2011 - Aug 29, 2009 at 04:34 AM
Related:
- Cutting and pasting 90+ columns into 1 column
- Tentacle locker 1 - Download - Adult games
- Fnaf 1 download pc - Download - Horror
- Igi 1 download - Download - Shooters
- Fnia 1 - Download - Adult games
- Poppy playtime chapter 1 download pc - Download - Horror
4 responses
Hi Excelguru,
Thanks for your prompt reply!
Is this the way it should look?
I am getting a runtime error.
Would this loop through all the other other 90+ columns in that sheet automatically?
Thanks again in advance!
Sub CombineColumns()
'Copy column b to Column a
Columns("b").Copy Destination:=Columns("A")
NewRowA = Range("A" & Rows.Count).End(xlUp).Row + 1
LastRowB = Range("c" & Rows.Count).End(xlUp).Row
Set CopyRange = Range("c1:c" & LastRowc)
CopyRange.Cut
Range("A" & NewRowA).Select
ActiveSheet.Paste
NewRowA = Range("A" & Rows.Count).End(xlUp).Row + 1
LastRowc = Range("d" & Rows.Count).End(xlUp).Row
Set CopyRange = Range("d1:d" & LastRowd)
CopyRange.Cut
Range("A" & NewRowA).Select
ActiveSheet.Paste
End Sub
Thanks for your prompt reply!
Is this the way it should look?
I am getting a runtime error.
Would this loop through all the other other 90+ columns in that sheet automatically?
Thanks again in advance!
Sub CombineColumns()
'Copy column b to Column a
Columns("b").Copy Destination:=Columns("A")
NewRowA = Range("A" & Rows.Count).End(xlUp).Row + 1
LastRowB = Range("c" & Rows.Count).End(xlUp).Row
Set CopyRange = Range("c1:c" & LastRowc)
CopyRange.Cut
Range("A" & NewRowA).Select
ActiveSheet.Paste
NewRowA = Range("A" & Rows.Count).End(xlUp).Row + 1
LastRowc = Range("d" & Rows.Count).End(xlUp).Row
Set CopyRange = Range("d1:d" & LastRowd)
CopyRange.Cut
Range("A" & NewRowA).Select
ActiveSheet.Paste
End Sub
Excelguru
Posts
261
Registration date
Saturday April 11, 2009
Status
Member
Last seen
June 21, 2011
307
Jun 27, 2009 at 08:59 AM
Jun 27, 2009 at 08:59 AM
Hi beladrian
instead of CopyRange.Copy Destination:=Range("A" & NewRowA) use
instead of CopyRange.Copy Destination:=Range("A" & NewRowA) use
CopyRange.Cut Range("A" & NewRowA).Select ActiveSheet.Paste
Excelguru
Posts
261
Registration date
Saturday April 11, 2009
Status
Member
Last seen
June 21, 2011
307
Jun 29, 2009 at 04:23 AM
Jun 29, 2009 at 04:23 AM
Hi beladrian
You have made a spelling mistake in the code
LastRowc = Range("d" & Rows.Count).End(xlUp).Row
Set CopyRange = Range("d1:d" & LastRowd)
You have made a spelling mistake in the code
LastRowc = Range("d" & Rows.Count).End(xlUp).Row
Set CopyRange = Range("d1:d" & LastRowd)
Excelguru
Posts
261
Registration date
Saturday April 11, 2009
Status
Member
Last seen
June 21, 2011
307
Aug 29, 2009 at 04:34 AM
Aug 29, 2009 at 04:34 AM
LastRowc = Range("d" & Rows.Count).End(xlUp).Row
Set CopyRange = Range("d1:d" & LastRowd)
I just meant that instead of LastRowc he used LastRowd in the second line.
This caused the error as excel could not find the value of LastRowd and hence it took the value as zero
There is no zeroth row or column in excel
Set CopyRange = Range("d1:d" & LastRowd)
I just meant that instead of LastRowc he used LastRowd in the second line.
This caused the error as excel could not find the value of LastRowd and hence it took the value as zero
There is no zeroth row or column in excel