I have an excel spread sheet (which only has data in column 1) and would like to copy it another using common dialog boxes.
Please help!
Printable View
I have an excel spread sheet (which only has data in column 1) and would like to copy it another using common dialog boxes.
Please help!
TIP: to find out the code for it...
record what you want to do in a macro in excel, then look at the code produced...:)
Tried that, there must be a simple way to copy everything in column one and paste it in an other application where there is a free space.:confused:
Try this....it will test your column.....it is slow as it will test all cells for a value
Sub Macro1()
Dim rngRange As Range
Dim bEmpty As Boolean
Dim iCounter As Integer
Set rngRange = Selection
bEmpty = True
For iCounter = Asc("A") To Asc("Z")
Sheets("Sheet1").Columns(Chr(iCounter) & ":" & Chr(iCounter)).Select
While bEmpty
For Each rngRange In Selection
Application.StatusBar = rngRange.Address
DoEvents
If rngRange <> "" Then
bEmpty = False
MsgBox " FOUND VALUE"
Exit For
Else
'Do nothing
End If
Next
Wend
If bEmpty Then
Exit For
Else
bEmpty = True
End If
Next
MsgBox "column" & Selection.Column & " is empty"
End Sub
Another possibility:
Selection.SpecialCells(xlCellTypeLastCell).Select
This selects the last used cell....meaning the next row (to be retrieved with the selection object) will be empty