Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy Cell Across Columns

I recorded a macro that copies a cell in B1 across to I1:

Selection.AutoFill Destination:=Range("B1:I1")
Type:=xlFillDefaultRange("B1:I1").Select

I effectively copied it across 7 columns. How would I write this s
that I can pass the number 7 to a variable and then uses this t
quantify how many columns across from the start cell I want to cop
from? Assuming start cell is B1.

Thank-yo

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Copy Cell Across Columns

ExcelMonkey

something like:

x = 7
Range("B1:C1").AutoFill _
Destination:=Range(Cells(1, 2), _
Cells(1, 2 + x)), _
Type:=xlFillDefault

Regards

Trevor


"ExcelMonkey " wrote in message
...
I recorded a macro that copies a cell in B1 across to I1:

Selection.AutoFill Destination:=Range("B1:I1"),
Type:=xlFillDefaultRange("B1:I1").Select

I effectively copied it across 7 columns. How would I write this so
that I can pass the number 7 to a variable and then uses this to
quantify how many columns across from the start cell I want to copy
from? Assuming start cell is B1.

Thank-you


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy Cell Across Columns

Thanks

--
Message posted from http://www.ExcelForum.com

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 a columns kevcar40 Excel Discussion (Misc queries) 2 September 18th 08 10:42 AM
Copy Columns jbjtc Setting up and Configuration of Excel 0 July 9th 07 05:00 PM
How do I copy columns between worksheets if the columns don't matc Miriam Excel Worksheet Functions 10 June 12th 06 04:29 PM
Copy columns values into separate columns Mike_can Excel Discussion (Misc queries) 7 May 27th 06 12:32 AM
how do I copy text to columns from one cell to another? Stressed! Excel Discussion (Misc queries) 8 May 11th 06 08:01 PM


All times are GMT +1. The time now is 05:30 AM.

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

About Us

"It's about Microsoft Excel"