Variable in Range

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
Application.Worksheets("Mold Flg Thk").Rows("10:" & introw).Insert
 
Try:

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

Regards

Trevor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top