VBA Macro with Message Box repeats itself, but it's not supposed to!!

Duffman4576

New Member
Joined
Sep 9, 2013
Messages
21
Helllo again Forum: I have a macro that works, but when I added in a MSG box, I discovered something very strange. Right now the Macro updates pieces of infromation (those are the only thing population the I8 range in the Adjustments tab.)
By inserting the message box, I see that the Macro performs the updates on Name A and Name B, the does it to Name B four more times! - and scary enough, it swaps out Name B's info for Name A's info.

Utlimatly, the infromation is correct but this really shouldn't be happening.

Can anyone tell me why it is looping like this and why I get a total of six message box's to click through instead of two?

Sub More_Adjustments()
Dim rng As Range
Dim i As Integer
For i = 5 To 25
Dim cell As Range
Set rng = Sheets("Adjustments").Range("I8:I28")
On Error Resume Next
For Each cell In rng
If cell.Value = cell.Offset(1).Value And cell.Value > 0 Then
MsgBox ("You are about to make a change to " & cell.Offset(0, 1).Value)
cell.Offset(1, 2).Resize(1, 6).Copy
Sheets("Report").Select
Range(Sheets("Inputs").Range("I" & i).Value).Select
Selection.PasteSpecial xlPasteValues
Selection.Interior.Color = 65535
Sheets("Report").Range(Sheets("Inputs").Range("H" & i).Value).Interior.Color = 65535
i = i + 2

Else
End If
Next cell
Next i

End Sub
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,215,479
Messages
6,125,043
Members
449,206
Latest member
Healthydogs

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