Vandana Jain
New Member
- Joined
- Nov 14, 2015
- Messages
- 3
Greetings there,
I have been trying to write code for a problem.
Problem is:
I need to insert some rows at 4 places in a worksheet at a time but at different ranges in same number.
Like, I need to insert 4 rows at Range 12, 24, 30, 45.
Every time, I will add rows at 4 places for sure but ranges would be different.
I have written some code for this:
Dim J as Long, Rng as String, I as Integer, K as Integer
J = InputBox("Type the number of paths to be inserted")
For K = 1 To 4
Rng = InputBox("Enter your range")
For I = 1 To J
Range(Rng).EntireRow.insert
Next
Next
Now, this block of code shows some error with Range Objective.
Please help me out.
I have been trying to write code for a problem.
Problem is:
I need to insert some rows at 4 places in a worksheet at a time but at different ranges in same number.
Like, I need to insert 4 rows at Range 12, 24, 30, 45.
Every time, I will add rows at 4 places for sure but ranges would be different.
I have written some code for this:
Dim J as Long, Rng as String, I as Integer, K as Integer
J = InputBox("Type the number of paths to be inserted")
For K = 1 To 4
Rng = InputBox("Enter your range")
For I = 1 To J
Range(Rng).EntireRow.insert
Next
Next
Now, this block of code shows some error with Range Objective.
Please help me out.