Activecell range copy
Hi Allan,
You can use things like:
Cells(ActiveCell.Row, ActiveCell.Column).End(xlUp).Select
to move up the column, but this will only take you from the current cell up
to the first cell below a blank cell. So if your range does contain a blank
above the curcell then you will need to use the above code again to jump the
blanks to the next non-empty cell, and again to move to the top of the next
block, and so on. The same methods can be used to move right across your
range, but once again you will run into problems using this method when
blanks exist. If you know more about your range then you might be able to do
it, for example, if you know that the range always starts on row 1, or if you
know there will be no blank cells in the first row of data, or if you know
that the number of columns will always be consistent.
If you don't mind having user input then you can ask for the range to be
selected manually using something like:
Dim myRange As Range
On Error Resume Next
Set myRange = Application.InputBox("Select Range", "Range", Type:=8)
If Err.Number < 0 Then
'INPUT BOX WAS CANCELLED
On Error GoTo 0
Else
'RANGE SELECTED
On Error GoTo 0
myRange.Select
End If
I hope this helps,
Sean.
--
(please remember to click yes if replies you receive are helpful to you)
"Allan" wrote:
So heres what I'm Try to do.
Copy a range1 from sheet1 to sheet2 to first blank row Col "A".
The range1 from sheet1 is of variable size and may contain empty cells.
Also range1 may not be in the same place everytime on sheet1, but
I have the current cell address which is the first column and last row of
the range.
curcell = ActiveWindow.RangeSelection.Address
Maybe using .Resize to determine range size??
Thanks Allan
|