This does what you described. Hope it helps
Private Sub Worksheet_Change(ByVal Target As Range)
ColToCheck = 1
CurrentRow = Target.Row
For i = 1 To CurrentRow - 1
If Cells(i, ColToCheck) = Cells(CurrentRow, ColToCheck) Then
Duplicate = True
Exit For
End If
Next i
If...
It is pretty standard Windows functionality to use TAB to go between fields. If you disable this, most windows application users would wonder why the TAB key wasn't working! You could program the Enter Key and the TAB key to have the same functionality. Using a full stop is the same as using the...
I suppose you could put a line in the change event along the lines of 'if len(DateString) = 2 then jump to next box' But I think leaving the user to TAB is better as it allows them to correct mistakes.
You could use a bunch of nested If, THEN, ELSEs.
eg
=IF(W12>0,SUM(A12,C12,E12,G12,I12,K12,M12,O12,Q12,S12,U12,W12),
IF(U12>0,SUM(A12,C12,E12,G12,I12,K12,M12,O12,Q12,S12,U12),
If(s12>0,...............))) etc etc
IF
See Also
Returns one value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE.
Use IF to conduct conditional tests on values and formulas.
Syntax
IF(logical_test,value_if_true,value_if_false)
Logical_test is any value or expression that can be...
If I understand the requirement, like this.
Sub Mysub()
LastCol = 10
For MyCol = 1 To LastCol
If Cells(2, MyCol) = "v" Then
Cells(2, MyCol) = Cells(15, MyCol)
End If
Next MyCol
End Sub
Try:
For Each s In ActiveDocument.Shapes
MsgBox s.Name
Next s
This returns the name of the text box
then:
ActiveDocument.Shapes("Text Box 4").Select
Selection.TypeText Text:="xxxx"
puts the text in
Thanks jedi (nice name!), but Skip's way allows the users to select the colours in the same way as they always have. I have now managed to keep track of the old cell location in the changeselection event using a public variable. I can then call the change event using the old location and check...
Skip,
Thanks for you response, I understand the reasoning, but how can I pass the previous cell's location to the Selection Change when the Target parameter holds only the new location.
The 2nd option sounds the most promising. Maybe removing built -in background colour toolbar function and replacing it with one of my own. I can't think what else you might have had in mind.
I would like to run a macro to check the contents of a cell when a user chages its colour. The colour change does not trigger the worksheet change event. Can anyone help?
Thanks for that - good tip. In this case however, worksheets(1) is not the active sheet so the screen is not updating as it runs. I tried it just in case but the overall time was the same.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.