Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default just trying to copy 6 rows to the right

I know this is a basic question, but I haven't used excel vb in years
so I'm trying to get some of the dust off.

I have the following vb code to copy a footer cell (which was used to
sum the contents of the column above it) and paste it to the 6 cells
to the right.
Range("E154").Select
Selection.Copy
Range("F154:L154").Select
ActiveSheet.Paste

I just want to make this a relative formula.

After a few of these, I'll start to get the swing of things again.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default just trying to copy 6 rows to the right

On Jul 27, 1:14*pm, tbmarlie wrote:
I know this is a basic question, but I haven't used excel vb in years
so I'm trying to get some of the dust off.

I have the following vb code to copy a footer cell (which was used to
sum the contents of the column above it) and paste it to the 6 cells
to the right.
Range("E154").Select
* * Selection.Copy
* * Range("F154:L154").Select
* * ActiveSheet.Paste

I just want to make this a relative formula.

After a few of these, I'll start to get the swing of things again.



I guess, before this, I need to figure out how to get to cell E154
which will also be changing because the number of rows will be
changing. If I start at Cell E3 and then put in code to get to the
very last cell (in this case, it just happens to be E154), I'm
assuming it would be something like the following:

Dim Rng As Range
Set Rng = Range("E3").End(xlDown)

But, once I have this range, I'm not sure of the code to actually get
me there using this range


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default just trying to copy 6 rows to the right

On Jul 27, 1:26*pm, tbmarlie wrote:
On Jul 27, 1:14*pm, tbmarlie wrote:

I know this is a basic question, but I haven't used excel vb in years
so I'm trying to get some of the dust off.


I have the following vb code to copy a footer cell (which was used to
sum the contents of the column above it) and paste it to the 6 cells
to the right.
Range("E154").Select
* * Selection.Copy
* * Range("F154:L154").Select
* * ActiveSheet.Paste


I just want to make this a relative formula.


After a few of these, I'll start to get the swing of things again.


I guess, before this, I need to figure out how to get to cell E154
which will also be changing because the number of rows will be
changing. *If I start at Cell E3 and then put in code to get to the
very last cell (in this case, it just happens to be E154), I'm
assuming it would be something like the following:

Dim Rng As Range
* * Set Rng = Range("E3").End(xlDown)

But, once I have this range, I'm not sure of the code to actually get
me there using this range


Oh, and the title of this s/b copying 6 cells to the right, not
copying 6 rows, sorry
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 420
Default just trying to copy 6 rows to the right

Check your other post.

On 07/27/2010 15:14, tbmarlie wrote:
I know this is a basic question, but I haven't used excel vb in years
so I'm trying to get some of the dust off.

I have the following vb code to copy a footer cell (which was used to
sum the contents of the column above it) and paste it to the 6 cells
to the right.
Range("E154").Select
Selection.Copy
Range("F154:L154").Select
ActiveSheet.Paste

I just want to make this a relative formula.

After a few of these, I'll start to get the swing of things again.


--
Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default just trying to copy 6 rows to the right

On Jul 27, 2:34*pm, Dave Peterson wrote:
Check your other post.

On 07/27/2010 15:14, tbmarlie wrote:

I know this is a basic question, but I haven't used excel vb in years
so I'm trying to get some of the dust off.


I have the following vb code to copy a footer cell (which was used to
sum the contents of the column above it) and paste it to the 6 cells
to the right.
Range("E154").Select
* * *Selection.Copy
* * *Range("F154:L154").Select
* * *ActiveSheet.Paste


I just want to make this a relative formula.


After a few of these, I'll start to get the swing of things again.


--
Dave Peterson


Try this:

Sub Copy_To_Right()
Dim rng As Range

Set rng = Selection
rng.Copy rng.Range("B1:G1")

End Sub
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
Change a Macro - Copy in Columns instead of copy in Rows ytayta555 Excel Programming 7 May 9th 09 06:32 PM
Copy pasting Rows, but need to Delete any Shapes/Pictures that are within copied rows Corey Excel Programming 2 August 1st 07 02:02 AM
Copy rows of data (eliminating blank rows) from fixed layout Sweepea Excel Discussion (Misc queries) 1 March 13th 07 11:05 PM
Find all rows of a color and copy those rows to a new worksheet hshayh0rn Excel Programming 3 May 26th 06 08:34 PM
Copy Rows and insert these rows before a page break AQ Mahomed Excel Programming 0 June 8th 04 09:09 AM


All times are GMT +1. The time now is 04:17 PM.

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"