#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Copy Row

Hello all,
Firstly, this is a great forum for picking up great tips. I am new to
VBA programming and am having (to me) a small problem with my
spreadsheet.

I have my data set out in the format of Col A across to Col Y.
(database)? I am using a macro written by Ron De Bruin to select an ID
number that is always in Col A.

What I need to be able to do is after selecting the required ID
number, select the entire data for the selected row so it can be
copied to another location. I have tried the Selection.End(xltoright)
but all this does is select the very end data.

Would this forum be able to show me the command I need? or maybe a
combined macro that will find the ID number, select the complete data
and copy to another location?

Many thanks.

Les

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Copy Row

try this
range(selection,selection.end(xltoright)).select

or without selecting
range(selection,selection.end(xltoright)).copy

--


Gary


"Johno" wrote in message
...
Hello all,
Firstly, this is a great forum for picking up great tips. I am new to
VBA programming and am having (to me) a small problem with my
spreadsheet.

I have my data set out in the format of Col A across to Col Y.
(database)? I am using a macro written by Ron De Bruin to select an ID
number that is always in Col A.

What I need to be able to do is after selecting the required ID
number, select the entire data for the selected row so it can be
copied to another location. I have tried the Selection.End(xltoright)
but all this does is select the very end data.

Would this forum be able to show me the command I need? or maybe a
combined macro that will find the ID number, select the complete data
and copy to another location?

Many thanks.

Les



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 421
Default Copy Row

Hi Johno,

To select the row data try:

Selection.Resize(1, 8)

To copy this to (say) cell A10 on Sheet2, try:


Selection.Resize(1, 8).Copy _
Destination:=Sheets("Sheet2").Range("A10")

If you are using Ron's code, you can be
certain that it is excellent. Post the code
you are using so that we can advise how y
our intent might be achieved.



---
Regards.
Norman


"Johno" wrote in message
...
Hello all,
Firstly, this is a great forum for picking up great tips. I am new to
VBA programming and am having (to me) a small problem with my
spreadsheet.

I have my data set out in the format of Col A across to Col Y.
(database)? I am using a macro written by Ron De Bruin to select an ID
number that is always in Col A.

What I need to be able to do is after selecting the required ID
number, select the entire data for the selected row so it can be
copied to another location. I have tried the Selection.End(xltoright)
but all this does is select the very end data.

Would this forum be able to show me the command I need? or maybe a
combined macro that will find the ID number, select the complete data
and copy to another location?

Many thanks.

Les


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Copy Row

On Fri, 30 May 2008 09:52:43 +0930, Johno wrote:

To both Gary K. and Norman J. many thanks for both suggestions, both
do exactely what I want. I will have a play around with both.

Cheers

Les

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy and paste versus copy and insert copied cells Alana New Users to Excel 1 September 28th 07 08:58 PM
Copy/Paste how to avoid the copy of formula cells w/o calc values Dennis Excel Discussion (Misc queries) 10 March 2nd 06 10:47 PM
copy formulas from a contiguous range to a safe place and copy them back later Lucas Budlong Excel Programming 2 February 22nd 06 08:26 PM
EXCEL FILE a copy/a copy/a copy ....filename ve New Users to Excel 1 September 29th 05 09:12 PM
Code to copy range vs Copy Entire Worksheet - can't figure it out Mike Taylor Excel Programming 1 April 15th 04 08:34 PM


All times are GMT +1. The time now is 09:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"