ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need coding help. (https://www.excelbanter.com/excel-programming/332057-need-coding-help.html)

Neddy[_4_]

Need coding help.
 

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


--
Neddy
------------------------------------------------------------------------
Neddy's Profile: http://www.excelforum.com/member.php...o&userid=24345
View this thread: http://www.excelforum.com/showthread...hreadid=379937


Damon Longworth[_3_]

Need coding help.
 
Try something similar to:

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

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

"Neddy" wrote:


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


--
Neddy
------------------------------------------------------------------------
Neddy's Profile: http://www.excelforum.com/member.php...o&userid=24345
View this thread: http://www.excelforum.com/showthread...hreadid=379937



Neddy[_5_]

Need coding help.
 

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


--
Neddy
------------------------------------------------------------------------
Neddy's Profile: http://www.excelforum.com/member.php...o&userid=24345
View this thread: http://www.excelforum.com/showthread...hreadid=379937


mangesh_yadav[_336_]

Need coding help.
 

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


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=379937


Neddy[_6_]

Need coding help.
 

Mangesh,

Thanks very much, that works a treat.

much obliged,

Nedy


--
Neddy
------------------------------------------------------------------------
Neddy's Profile: http://www.excelforum.com/member.php...o&userid=24345
View this thread: http://www.excelforum.com/showthread...hreadid=379937


mangesh_yadav[_347_]

Need coding help.
 

Thanks for the feedback.

Manges

--
mangesh_yada
-----------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047
View this thread: http://www.excelforum.com/showthread.php?threadid=37993


Damon Longworth[_3_]

Need coding help.
 
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" wrote:


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


--
Neddy
------------------------------------------------------------------------
Neddy's Profile: http://www.excelforum.com/member.php...o&userid=24345
View this thread: http://www.excelforum.com/showthread...hreadid=379937


Subject: 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" wrote:


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




All times are GMT +1. The time now is 05:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com