Re: Excel VBA Macro for getting unique values
Have you tried copying column A to Column K and then removing duplicates?
Re: Excel VBA Macro for getting unique values
Have you tried copying column A to Column K and then removing duplicates?
Re: Excel VBA Macro for Prioritizing a list
You can use this code, it's working for me!
(Make sure this is under Sheet1(Priorities) and not module 1
Private Sub cmdPriority_Click()
Dim srow As Integer
srow = 2
Dim constant1 As Integer
Dim constant2 As Integer
Do Until Len(Cells(srow, 3)) = 0
If Len(Cells(srow, 3)) <> 0 Then
If Cells(srow, 8) = "No" Then
If Cells(srow, 7) = "Yes" Then
If UCase(Cells(srow, 5)) = "STRENGTH" Then constant1 = 0
If UCase(Cells(srow, 5)) = "MIXED" Then constant1 = 5
If UCase(Cells(srow, 5)) = "MARTIALARTS" Then constant1 = 10
If UCase(Cells(srow, 5)) = "CARDIO" Then constant1 = 15
If UCase(Cells(srow, 5)) = "DANCE" Then constant1 = 20
If UCase(Cells(srow, 6)) = "BEGINNER" Then constant2 = 0
If UCase(Cells(srow, 6)) = "BEGINNERINTERMEDIATE" Then constant2 = 5
If UCase(Cells(srow, 6)) = "INTERMEDIATE" Then constant2 = 10
If UCase(Cells(srow, 6)) = "INTERMEDIATEADVANCED" Then constant2 = 15
If UCase(Cells(srow, 6)) = "ADVANCED" Then constant2 = 20
If UCase(Cells(srow, 6)) = "EXPERT" Then constant2 = 25
Cells(srow, 2) = constant1 + constant2 + Cells(srow, 4)
Else
'Code if G2 is not "Yes"
End If
Else
'Code if H2 is not "No"
End If
End If
srow = srow + 1
Loop
End Sub
Display More
Re: Excel/VBA Userform - Revert to previous value in textbox. (Undo)
Hello, you can set a variable to store the text box value prior to the change:
Dim OldTxtValue as String 'Set your variable as module scope and not procedural scope (write the Dim above the first Sub). Here is a guide explaining this. https://support.microsoft.com/en-us/kb/141693
sub JRBARRON
OldTxtValue = Textbox1.Value 'When the Sub that changes the value that you will need to undo is ran, first store the old value into the variable you specified at the module level.
'Code goes here that executes
End sub
Sub UndoSub
Textbox1.Value = OldTxtValue 'Calls the stored variable
End sub
Does this all make sense?
Sincerely,
-Max
Re: Excel VBA Macro for Prioritizing a list
Hello,
Without opening and diving into your code, if you need help moving from row to row try this:
Sub dtp81390()
Dim SRow As Integer
SRow = 1 'Row you would like to start your code in
Do Until Len(Cells(SRow, 3)) = 0
'Your code goes here, use "SRow as your Row number. So Cells A2 (assuming you are on your second loop) would be "Cells(SRow,1)")
SRow = SRow + 1 'This moves your loop to the next row, so SRow will = 2 on your second loop, 3 on your 3rd, etc.
Loop
End Sub