How to make a macro run once a dropdown list
Solved/Closed
Related:
- How to make a macro run once a dropdown list
- How to change your best friends list on snapchat to 3 - Guide
- My contacts list names - Guide
- Counter strike 1.6 cheats list - Guide
- Whatsapp country code list - Guide
- Amd crossfire compatibility list - Guide
4 responses
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
Mar 12, 2010 at 05:24 PM
Mar 12, 2010 at 05:24 PM
Well first let me say, failure is a very valid option :P
You need to define this function
Private Sub Worksheet_Change(ByVal Target As Range)
End Sub
Let say the sheet that we are talking about is sheet1
So open the VBE and double click on sheet1 on the project explorer
Paste this routine and read the comments in the code about blank
You need to define this function
Private Sub Worksheet_Change(ByVal Target As Range)
End Sub
Let say the sheet that we are talking about is sheet1
So open the VBE and double click on sheet1 on the project explorer
Paste this routine and read the comments in the code about blank
Private Sub Worksheet_Change(ByVal Target As Range) 'here 3 is column number 3 which is column C If (Target.Column <> 3) Then Exit Sub Application.EnableEvents = False thisrow = Target.Row If Target.Value = "" Then 'now you can comment out the code if it does not make sense 'but the idea is if the cell in column C has been cleared out, 'corresponding date and time should be cleared out too Cells(thisrow, "A") = "" Cells(thisrow, "B") = "" Else Cells(thisrow, "A") = Date Cells(thisrow, "B") = Time End If Application.EnableEvents = True End Sub
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
Mar 16, 2010 at 02:00 PM
Mar 16, 2010 at 02:00 PM
Add line
Cell(thisrow, "D").select
just above
Application.EnableEvents = True
Cell(thisrow, "D").select
just above
Application.EnableEvents = True
You ROCK man!! that worked great.. now is there any way to have the cursor move to the cell in 'D' after inputting the date and time?
That worked great!
1 more thing I am being asked to do now is this: lets say I have data filled in a row (using the event created above), say row 2, if there is nothing in cell G2 then change the row background 'RED' . If data is entered into cell G2 then change background color back to white.
I am researching how to do this but am thinking it might be quicker just to ask. can you help with this too??
Thanks a bunch!
1 more thing I am being asked to do now is this: lets say I have data filled in a row (using the event created above), say row 2, if there is nothing in cell G2 then change the row background 'RED' . If data is entered into cell G2 then change background color back to white.
I am researching how to do this but am thinking it might be quicker just to ask. can you help with this too??
Thanks a bunch!
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
Mar 17, 2010 at 03:15 PM
Mar 17, 2010 at 03:15 PM
Look into conditional formatting. That will resolve this issue
May 4, 2012 at 11:20 AM