Need coding help.

  • Thread starter Thread starter Neddy
  • Start date Start date
N

Neddy

Hello,

Jim was good enough to put me on the right track, but I'm still
confused a bit (OK, a lot).

Here is the code and the explantion within it,

Sub DownloadFormatCopyTAB()
'
' DownloadFormatCopyTAB Macro
' Macro recorded 17/06/05 by IBM
'
' Downloads TAB data from web, formats and copies to
' TodaysRaces sheet at selected cell. Only cols D and E from
' the downloaded data are used.
'
ActiveSheet.PasteSpecial Format:="Text", Link:=False,
DisplayAsIcon:= _
False
'Note the range downloaded contains data in cols D to Q.
'only cols D and E are required.

Range("F8", Range("F8").End(xlDown)).Cut Range("E8")
Selection.Copy

' How do I select only D8:Exx to copy across???

Sheets("TodaysRaces").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
......................................................

The above works, but copies the whole lot across, instead of the
required
range D8:Exx. The downloaded data has variable items.

Thanks
Neddy
 
Try something similar to:

LastRow = Range("F8").End(xlDown).Row

Range("D8:E" & LastRow).copy
 
Sorry, that doesn't work. It selects D8:E to the end of the sheet. It
doesn't select only cells with data.

Thanks
Dave
 
Try

Range("D8:E" & Range("D8").End(xlDown).Row).copy

probably it was a typo, Damon must have meant E8 and not F8. But You
may either try D8 or E8 as per your case.

Mangesh
 
Do you have any data in column F when this code runs? Your goal is to use a
column that has data down to your desired row. You were using column F in
your code. Try another column.

If there are any blanks in your data, the "end down" process will give you
incorrect results. It is generally better to use "end up". Something similar
to:

LastRow = Range("D65536").End(xlup).row

Neddy said:
Sorry, that doesn't work. It selects D8:E to the end of the sheet. It
doesn't select only cells with data.

Thanks
Dave
Subject: RE: Need coding help. 6/16/2005 7:04 PM PST

By: Damon Longworth In: microsoft.public.excel.programming


Try something similar to:

LastRow = Range("F8").End(xlDown).Row

Range("D8:E" & LastRow).copy

Neddy said:
Jim was good enough to put me on the right track, but I'm still
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top