Array problem...

daniel50096230

Board Regular
Joined
May 2, 2008
Messages
163
I would like to use array v to store all the results of the for loop u...How can Ido it?

Code:
Dim myRange As Range
Dim AnsRange1 As Integer
Dim AnsRange As Range
Set myRange = Application.InputBox(Prompt:="Select row to insert 10 rows below", Type:=8)
AnsRange1 = myRange.Row
Dim u As Integer
Dim v As Integer
Dim var() As Single
v = 0
For u = 23 To 24022 Step 9
 var(v) = u
Next u
If Not (AnsRange1 = v) Then
MsgBox AnsRange1
Else
Range(AnsRange1 & ":" & AnsRange1 + 9).Insert Shift:=xlDown
End If
End If
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Ok..I will try it again...But why don't it execute the Else statement if the record is match?As I had try lots of time,it just keep on prompt out the message box..
 
Upvote 0
Because it tests the start row with the number of steps, 2677, so unless you start at 2677 it will not be equal. What are you trying to test for equality?
 
Upvote 0
Ok...I would like to let the user just can adding the rows if they choose the row number that match with the for loop result...
 
Upvote 0
Sorry, I appreciate that English may not be your first language, but what you have written just reads as gobbledygook to me.
 
Upvote 0

Forum statistics

Threads
1,214,887
Messages
6,122,095
Members
449,064
Latest member
Danger_SF

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top