VBA 'Cells.Value' no longer returns visible value in cell?

bfishertarget

New Member
Joined
Oct 1, 2012
Messages
8
Good Morning-

I have a simple excel macro which is triggered by the worksheet_change event. The macro is coded like this:

For q = 2 To 600
If Worksheets("Threshold Tracker").Cells(q, 1).Value = "" Then
Worksheets("Threshold Tracker").Cells(q, 1).Value = Input1
Worksheets("Threshold Tracker").Cells(q, 2).Value = Date
Worksheets("Threshold Tracker").Cells(q, 3).Value = Time
q = 600
End If
Next q

2 days ago this code worked great, today I open the file and the code will run but no values are showing up in the "Threshold Tracker" cells?? Could there be some setting that adjusted itself?

Thanks in advance,

-B
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
The For loop will only run once - with 'q' set to 2? doesn't look right, and what is 'Input1'
 
Upvote 0
I can tell it is running because of the notification bar in the bottom corner of excel, also I can run the macro through the visual basic screen and 'step' it along. As for A2:A600, that is just a reference column. If Cell A1 is blank, then fill cells with values. If A1 is not blank, then go to A2 and continue until it finds a blank cell in A. This eliminates the macro from over-writing previous data.
 
Upvote 0
Sorry, I may not be clear. Here is the code for the entire worksheet. I start at Q = 2 because row one (or Q=1) is my header row. I also have another worksheet with very similar code, and it too is now acting the same way.

Private Sub Worksheet_Change(ByVal Target As Range)
MSG1 = MsgBox("Changing these thresholds will impact the scheduling tool. Do you wish to continue?", vbYesNo, "Thresholds Changed!")
If MSG1 = vbYes Then
Input1 = InputBox("Please enter your full name (i.e. Last Name,First Name):", "Threshold Changes")

For q = 2 To 600
If Worksheets("Threshold Tracker").Cells(q, 1).Value = "" Then
Worksheets("Threshold Tracker").Cells(q, 1).Value = Input1
Worksheets("Threshold Tracker").Cells(q, 2).Value = Date
Worksheets("Threshold Tracker").Cells(q, 3).Value = Time

q = 600
End If
Next q
Else

Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True

End If

End Sub
 
Last edited:
Upvote 0
Is the code trying to find the first empty row in column A on sheet 'Threshold Tracker'?

Which row is that?
 
Upvote 0
Norie-

All of the code is contained in Microsoft Visual Basic for Worksheet "Thresholds", and the event Worksheet_Change (on "Threshold Tracker" Worksheet) is what executes the code. As stated before, the code worked Monday and today it will run but not put any "text" or "Value" in the desired cells (q1-q4)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,517
Messages
6,125,290
Members
449,218
Latest member
Excel Master

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