Add Information Box to Macro

  • Thread starter Thread starter Mr. Matt
  • Start date Start date
M

Mr. Matt

HI,
I'd like to add a message box that requires no input to the following macro.
The message box should say "Reviewing Row " and should close when the
macro is done.

THANKS!


Private Sub CommandButton1_Click()
Dim i As Long

i = 7
Do
If Sheets(2).Cells(i, 8).Value = "CLOSED" Then
Rows(i).EntireRow.Hidden = True
End If
i = i + 1
Loop Until i = 300

End Sub
 
Have you tried
Application.StatusBar = "Reviewing Row [" & i & "]"

and before the End Sub put this
Application.StatusBar = False
 
Code now looks like this. Doesn't provide a window (message box) that shows
which row the macro is counting.

Private Sub CommandButton1_Click()
Dim i As Long

i = 7
Do
If Sheets(2).Cells(i, 8).Value = "CLOSED" Then
Rows(i).EntireRow.Hidden = True
End If
i = i + 1
Application.StatusBar = "Reviewing Row [" & i & "]"

Loop Until i = 300
Application.StatusBar = False

End Sub

Barb Reinhardt said:
Have you tried
Application.StatusBar = "Reviewing Row [" & i & "]"

and before the End Sub put this
Application.StatusBar = False
--
HTH,

Barb Reinhardt



Mr. Matt said:
HI,
I'd like to add a message box that requires no input to the following macro.
The message box should say "Reviewing Row " and should close when the
macro is done.

THANKS!


Private Sub CommandButton1_Click()
Dim i As Long

i = 7
Do
If Sheets(2).Cells(i, 8).Value = "CLOSED" Then
Rows(i).EntireRow.Hidden = True
End If
i = i + 1
Loop Until i = 300

End Sub
 
Can you see the statusbar in the bottom left corner? Where you see Ready or
Edit or Enter.

If yes, then that's where the message will appear. But with just 300 rows,
it'll go by very fast!

I have a followup question for you, too.

You use Sheets(2) in your code.

Is that the sheet with the commandbutton?

If yes, then I'd use:

Option Explicit
Private Sub CommandButton1_Click()
Dim iRow As Long

Application.ScreenUpdating = False 'hide the flickering

For iRow = 7 To 300
Application.StatusBar = "Reviewing Row [" & iRow & "]"
If UCase(Me.Cells(iRow, 8).Value) = UCase("Closed") Then
Me.Rows(iRow).Hidden = True
Else
Me.Rows(iRow).Hidden = False 'do you want this???
End If
Next iRow

With Application
.StatusBar = False 'give it back to excel
.ScreenUpdating = True
End With

End Sub

If the commandbutton is on a userform -- or processing Sheets(2) from a
different sheet, then I'd qualify those ranges with the sheet that I want.



Mr. Matt said:
Code now looks like this. Doesn't provide a window (message box) that shows
which row the macro is counting.

Private Sub CommandButton1_Click()
Dim i As Long

i = 7
Do
If Sheets(2).Cells(i, 8).Value = "CLOSED" Then
Rows(i).EntireRow.Hidden = True
End If
i = i + 1
Application.StatusBar = "Reviewing Row [" & i & "]"

Loop Until i = 300
Application.StatusBar = False

End Sub

Barb Reinhardt said:
Have you tried
Application.StatusBar = "Reviewing Row [" & i & "]"

and before the End Sub put this
Application.StatusBar = False
--
HTH,

Barb Reinhardt



Mr. Matt said:
HI,
I'd like to add a message box that requires no input to the following macro.
The message box should say "Reviewing Row " and should close when the
macro is done.

THANKS!


Private Sub CommandButton1_Click()
Dim i As Long

i = 7
Do
If Sheets(2).Cells(i, 8).Value = "CLOSED" Then
Rows(i).EntireRow.Hidden = True
End If
i = i + 1
Loop Until i = 300

End Sub
 
Ps. If you can't see the statusbar:
Tools|Options|View tab
and turn it on.

Dave said:
Can you see the statusbar in the bottom left corner? Where you see Ready or
Edit or Enter.

If yes, then that's where the message will appear. But with just 300 rows,
it'll go by very fast!

I have a followup question for you, too.

You use Sheets(2) in your code.

Is that the sheet with the commandbutton?

If yes, then I'd use:

Option Explicit
Private Sub CommandButton1_Click()
Dim iRow As Long

Application.ScreenUpdating = False 'hide the flickering

For iRow = 7 To 300
Application.StatusBar = "Reviewing Row [" & iRow & "]"
If UCase(Me.Cells(iRow, 8).Value) = UCase("Closed") Then
Me.Rows(iRow).Hidden = True
Else
Me.Rows(iRow).Hidden = False 'do you want this???
End If
Next iRow

With Application
.StatusBar = False 'give it back to excel
.ScreenUpdating = True
End With

End Sub

If the commandbutton is on a userform -- or processing Sheets(2) from a
different sheet, then I'd qualify those ranges with the sheet that I want.

Mr. Matt said:
Code now looks like this. Doesn't provide a window (message box) that shows
which row the macro is counting.

Private Sub CommandButton1_Click()
Dim i As Long

i = 7
Do
If Sheets(2).Cells(i, 8).Value = "CLOSED" Then
Rows(i).EntireRow.Hidden = True
End If
i = i + 1
Application.StatusBar = "Reviewing Row [" & i & "]"

Loop Until i = 300
Application.StatusBar = False

End Sub

Barb Reinhardt said:
Have you tried
Application.StatusBar = "Reviewing Row [" & i & "]"

and before the End Sub put this
Application.StatusBar = False
--
HTH,

Barb Reinhardt



:

HI,
I'd like to add a message box that requires no input to the following macro.
The message box should say "Reviewing Row " and should close when the
macro is done.

THANKS!


Private Sub CommandButton1_Click()
Dim i As Long

i = 7
Do
If Sheets(2).Cells(i, 8).Value = "CLOSED" Then
Rows(i).EntireRow.Hidden = True
End If
i = i + 1
Loop Until i = 300

End Sub

 
Back
Top