LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Using VBA to select dynamic number of rows

I am trying to write a macro that will pass a value from an input form to VBA
code to insert rows. I currently have a sheet with 100 rows and I have a
button on the sheet that adds a row for each additional item needed. The
problem is that when I need to add a bunch of rows the code takes a while to
run, so I would like it to select more than one row @ a time to copy and
insert.

I have the following code. Does anyone know how to make the piece of code
"Rows(Rowct).Select" select a number of rows that is dependent on what the
user enters into the form?

Application.ScreenUpdating = False

Sheets("Baseline").Select
Range("AL2").Value = txtcat.Value
Rowct = Range("itemcounter").Value
txtcat.Value = "0"
frmI.Hide

Dim lCount As Long
Sheets("Baseline").Select
Rowct = Range("itemcounter").Value

If Sheets("Baseline").Range("AL1").Text = "1" Then
lCount = 0
Do Until lCount = Range("AL2").Value
lCount = lCount + 1
Rows(Rowct).Select
Selection.COPY
Rows(Rowct + 1).Select
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False
Range("A11").Select
Loop
 
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
Select Large Number of Rows Mike H. Excel Discussion (Misc queries) 5 November 5th 07 11:56 PM
NUMBER OF ROWS IN A DYNAMIC RANGE Larry Excel Worksheet Functions 0 July 14th 06 09:19 PM
Number rows in a dynamic range fishmen Excel Worksheet Functions 3 May 5th 06 07:26 PM
Select number of rows in a graph? cratediggah Excel Programming 0 January 11th 06 03:08 PM
Dynamic number of ROWS Gerrym Excel Worksheet Functions 2 November 16th 04 04:03 PM


All times are GMT +1. The time now is 11:50 PM.

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"