Need a VBA Excel macro to do the following:

March 29, 2011 at 06:39:53
Specs: Windows XP
1. Find and select the last column that contains data from worksheet1.
2. Copy this entire column to worksheet2.

Please help! Thanks!


See More: Need a VBA Excel macro to do the following:

Report •

#1
April 4, 2011 at 14:46:14
You will need to play with this but it should give you some ideas

Sub MyTest()
Dim iEndRow As Long, iEndCol As Long
iEndRow = Range("B65536").End(xlUp).Row 'find a column that always has data
iEndCol = Range("AZ" & iEndRow).End(xlToLeft).Column

MsgBox iEndRow & " " & iEndCol

Columns(iEndCol).Copy
Sheet2.Select
Sheet2.Range("A1").PasteSpecial (xlPasteAll) 'change the column to one of your choice

End Sub


Report •
Related Solutions


Ask Question