View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Black country boy Black country boy is offline
external usenet poster
 
Posts: 8
Default Selecting data to copy and paste

Thanks Norman. I will try this at work tomorrow and let you know how I got on.

"Norman Jones" wrote:

Hi Black country boy,

To define your variable column A range try something like:

'================
Public Sub Tester001()
Dim WB As Workbook
Dim SH As Worksheet
Dim rng As Range

Set WB = Workbooks("Book1") '<<==== CHANGE
Set SH = WB.Sheets("Sheet11") '<<==== CHANGE

iLastRow = SH.Cells(Rows.Count, "A").End(xlUp).Row

Set rng = SH.Range("A1:A" & iLastRow)

'Your code

End Sub
'<<================


---
Regards,
Norman


"Black country boy" wrote in
message ...
I have a macro that sorts data into the correct order, then I manually copy
and paste into a different application. I would like to write code into
the
macro that copies the data after sorting, but the length of the data list
is
variable, i.e. sometimes it could be spread from A1 to A52, sometimes A1
to
A105. Each time can give a different length, (but always in column A
only).
Also, some of the cells are blank, but must be copied as blank.
Thanks.