#1   Report Post  
aftamath
 
Posts: n/a
Default Variable in Range

This is my code:

Sub Macro1()

Dim intRow As Integer
intRow = InputBox(Prompt:="Enter Age", Title:="Age")

Application.Worksheets("Mold Flg Thk").Rows("10:19").Insert

End Sub

I would like to use the intRow variable in the .Rows range. But,

Application.Worksheets("Mold Flg Thk").Rows("10:intRow").Insert

doesn't work and neither do a few other variations.

Can the range be defined using the intRow variable?
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

Application.Worksheets("Mold Flg Thk").Rows("10:" & introw).Insert



aftamath wrote:

This is my code:

Sub Macro1()

Dim intRow As Integer
intRow = InputBox(Prompt:="Enter Age", Title:="Age")

Application.Worksheets("Mold Flg Thk").Rows("10:19").Insert

End Sub

I would like to use the intRow variable in the .Rows range. But,

Application.Worksheets("Mold Flg Thk").Rows("10:intRow").Insert

doesn't work and neither do a few other variations.

Can the range be defined using the intRow variable?


--

Dave Peterson
  #3   Report Post  
Trevor Shuttleworth
 
Posts: n/a
Default

Try:

Application.Worksheets("Mold Flg Thk").Rows("10:" & intRow).Insert

Regards

Trevor


"aftamath" wrote in message
...
This is my code:

Sub Macro1()

Dim intRow As Integer
intRow = InputBox(Prompt:="Enter Age", Title:="Age")

Application.Worksheets("Mold Flg Thk").Rows("10:19").Insert

End Sub

I would like to use the intRow variable in the .Rows range. But,

Application.Worksheets("Mold Flg Thk").Rows("10:intRow").Insert

doesn't work and neither do a few other variations.

Can the range be defined using the intRow variable?



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
How do I create a schedule from a list of dates ? Gavin Morris Charts and Charting in Excel 2 October 28th 10 04:08 PM
Match function...random search? Les Excel Worksheet Functions 10 July 28th 05 11:54 AM
How to use a variable for a range Jeff Lowenstein Excel Worksheet Functions 1 July 26th 05 02:14 AM
Is it possible to set a variable range in a macro? Mary About this forum 0 June 12th 05 06:26 PM
Set Data Range by Variable MJSlattery Excel Discussion (Misc queries) 4 June 10th 05 07:48 AM


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