Syntax error in VB code

Egirl212

New Member
Joined
Aug 14, 2017
Messages
6
I have the following syntax error when trying to select multiple rows with VB (jumping 2 rows in between)
Please help.



For i = ("8 To 11") & ("14 To 17")

Thank you!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
I have the following syntax error when trying to select multiple rows with VB (jumping 2 rows in between)
Please help.



For i = ("8 To 11") & ("14 To 17")

Thank you!
You provide insufficient detail.
I assume that you have need to select rows(8:11) and maybe paste them to rows(14:17) thereby skipping rows 12 and 13.
Even that assumption maybe wrong.

Please be more specific.
 
Upvote 0
Thank you Brian.
I wanted to select rows from 8 to 11 and from 14 to 17.

You provide insufficient detail.
I assume that you have need to select rows(8:11) and maybe paste them to rows(14:17) thereby skipping rows 12 and 13.
Even that assumption maybe wrong.

Please be more specific.
 
Upvote 0
What do you need to do with your selections?
Once you have chosen rows 8-11 what is to happen to them before you choose 14-17?
You are still not telling enough of your story.
 
Upvote 0
Hi,
one way maybe would be to advance your index variable i to skip to next block

e.g.

Code:
For i = 8 To 17
    i = IIf(i = 12, 14, i)

'your code


Next i

Dave
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

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