Tech Support Guy banner

Excel Macro Advice - MsgBox Value

9968 Views 5 Replies 3 Participants Last post by  Zack Barresse
I am trying to generate a Message Box with a changing value in the text that references a cell value. For example, if there are 2 errors on a worksheet (reflected by a "2" in cell A1), I want the MsgBox to say "You have 2 errors on this page". And if there are 12 errors (with a "12" already in cell A1), "You have 12 errors on this page". Can someone help me please?
Status
Not open for further replies.
1 - 3 of 6 Posts
ddockstader said:
Again, assuming that the number of errors is in cell A1

Sub Macro1()

MsgBox ("You have " & Range("A1").Value & " errors on this page.")

End Sub
Thanks that is exactly what I needed. Now for one more trick. I have a column that will have values changing but not in consecutive order. For example if I had range A1:A10, only A1, A4, and A9 would have values, but the rest of the cells would be blank. I need to be able to generate A1, A4, and A9 into the next column consecutively as B1, B2, and B3. The A column values could change (including the number of values) and I need the B column to react accordingly. So the next time I run the data, I could have A2, A3, A4, A6, and A10 with data in them- so I need column B to be able to react and put the values (in order) as B1, B2, B3, B4, and B5. Oh and I need all this done in a MsgBox. Can you help? Thanks so much.
1 - 3 of 6 Posts
Status
Not open for further replies.
Top