Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default variable rows to be copied

I have multiple tabs in one spreadsheet. When the user enters a tab I have a
user form that asks for how many rows they would like to have. This could
range from 1-250. The textbox info is placed in cell m2. I don't know how to
copy range c15:k15 the number of times it takes to meet the users request. An
example would be if they entered 5 in the textbox, select range c15:k15 and
copy in down four times. Any help would be great.

Tim Peter
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default variable rows to be copied

Your description is not very clear. To expand Range("C15:K15") to five
rows:

rng = Range("C15:K15")
rng.Resize(5, 9)

would increase the range size by five rows.


"tpeter" wrote in message
...
I have multiple tabs in one spreadsheet. When the user enters a tab I have
a
user form that asks for how many rows they would like to have. This could
range from 1-250. The textbox info is placed in cell m2. I don't know how
to
copy range c15:k15 the number of times it takes to meet the users request.
An
example would be if they entered 5 in the textbox, select range c15:k15
and
copy in down four times. Any help would be great.

Tim Peter



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default variable rows to be copied

Give this a try...

HowManyTimes = 5
Range("C15:K15").Resize(HowManyTimes).Value = Range("C15:K15").Value

--
Rick (MVP - Excel)


"tpeter" wrote in message
...
I have multiple tabs in one spreadsheet. When the user enters a tab I have
a
user form that asks for how many rows they would like to have. This could
range from 1-250. The textbox info is placed in cell m2. I don't know how
to
copy range c15:k15 the number of times it takes to meet the users request.
An
example would be if they entered 5 in the textbox, select range c15:k15
and
copy in down four times. Any help would be great.

Tim Peter


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default variable rows to be copied

If it is just copying, then:

Range("C15:K15").Copy Range("C15:K20")


"tpeter" wrote in message
...
I have multiple tabs in one spreadsheet. When the user enters a tab I have
a
user form that asks for how many rows they would like to have. This could
range from 1-250. The textbox info is placed in cell m2. I don't know how
to
copy range c15:k15 the number of times it takes to meet the users request.
An
example would be if they entered 5 in the textbox, select range c15:k15
and
copy in down four times. Any help would be great.

Tim Peter



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default variable rows to be copied

try something like this:

Option Explicit
Sub Main()
Dim qrows As Long
qrows = InputBox("How many rows")
If qrows 0 Then
Range("C15:k15").Copy
Range("C16").Resize(qrows - 1).PasteSpecial xlPasteAll
Application.CutCopyMode = False
End If


End Sub

"tpeter" wrote:

I have multiple tabs in one spreadsheet. When the user enters a tab I have a
user form that asks for how many rows they would like to have. This could
range from 1-250. The textbox info is placed in cell m2. I don't know how to
copy range c15:k15 the number of times it takes to meet the users request. An
example would be if they entered 5 in the textbox, select range c15:k15 and
copy in down four times. Any help would be great.

Tim Peter

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
Assign copied range to a variable johnmasvou Excel Programming 3 March 20th 09 10:44 AM
Inserting copied rows rgodchaux Excel Worksheet Functions 3 March 6th 08 02:48 AM
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
Stopping a constant variable cell from being copied. Link New Users to Excel 3 May 15th 07 03:35 AM
blank rows between copied rows Arif Excel Discussion (Misc queries) 2 May 5th 06 12:18 PM


All times are GMT +1. The time now is 11:42 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"