VBA: If cell <> More then move to Next I

scabers

New Member
Joined
Jul 4, 2017
Messages
6
Hello, I've written a macro with a rule that if a value is not equal to MORE then exit sub.
That's working fine, but instead, I'd like it to state that if Value is not equal to MORE then go to Next record (Next I)

Code I have to end the sub is as follows.

If xlsheet.Cells(i, 26).Value <> "MORE" Then Exit Sub
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Can you please post your entire code? Depending how you have your existing code structured will determine how to best handle this.
 
Upvote 0
Had to redact some of the language due to proprietary info but actual excel code is all still below.

Set REDACTED2 = CreateObject("REDACTED3.REDACTED2")
Set REDACTED2 = CreateObject("REDACTED3.REDACTED2")
Set REDACTED1 = CreateObject("REDACTED3.REDACTED1")
Set REDACTED2 = CreateObject("REDACTED3.REDACTED2")

autECLConnList.Refresh
REDACTED2Obj.SetConnectionByHandle (REDACTED3 (1).Handle)
REDACTED1.SetConnectionByHandle (REDACTED3 (1).Handle)
REDACTED2.SetConnectionByHandle (REDACTED3 (1).Handle)

Dim i As Long
Dim xlsheet As Excel.Worksheet
Set xlsheet = Worksheets("INPUT")

For i = 2 To xlsheet.Range("A65536").End(xlUp).Row
REDACTED2.SetText "REDACTED4", 1, 2
REDACTED2.SetText Format(xlsheet.Cells(i, 1)), 1, 11
REDACTED2.SendKeys "[enter]"

xlsheet.Cells(i, 3) = REDACTED2.GetText(7, 2, 79)

xlsheet.Cells(i, 4) = REDACTED2.GetText(8, 2, 79)

xlsheet.Cells(i, 5) = REDACTED2.GetText(9, 2, 79)

xlsheet.Cells(i, 6) = REDACTED2.GetText(10, 2, 79)

xlsheet.Cells(i, 7) = REDACTED2.GetText(11, 2, 79)

xlsheet.Cells(i, 8) = REDACTED2.GetText(12, 2, 79)

xlsheet.Cells(i, 9) = REDACTED2.GetText(13, 2, 79)

' end reference cell
xlsheet.Cells(i, 26) = REDACTED2.GetText(14, 75, 4)

If xlsheet.Cells(i, 26).Value <> "MORE" Then Exit Sub

REDACTED2.SendKeys "[PF8]"

Next I
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
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