Whenever I run the following macro, it changes the current value of the data validation list ("YES" or "NO") to the opposite if it is "True." What can I do so that after it is done, I still have the same values. Thanks!!!
If Sheets("Change Log").Range("B7") = "NO" Then
Sheets("Change Log").Range("B5:B6").Copy
Sheets("Change Log").Range("B16").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End If
Sheets("Change Log").Range("B7") = "YES"
If Sheets("Change Log").Range("C7") = "NO" Then
Sheets("Change Log").Range("C5:C6").Copy
Sheets("Change Log").Range("B18").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End If
Sheets("Change Log").Range("C7") = "YES"
Last edited by gophins; 09-30-2009 at 12:45 PM.
hello gophins.
Im not sure i completly understand. though if you ' or rem out both lines after the if statement.
range B7 and C7 will not change. though this will make the code copy the range's each time it is run.Code:If Sheets("Change Log").Range("B7") = "NO" Then Sheets("Change Log").Range("B5:B6").Copy Sheets("Change Log").Range("B16").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False End If 'Sheets("Change Log").Range("B7") = "YES" If Sheets("Change Log").Range("C7") = "NO" Then Sheets("Change Log").Range("C5:C6").Copy Sheets("Change Log").Range("B18").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False End If 'Sheets("Change Log").Range("C7") = "YES"
Hope this helps
Thanks D_rennie,
I'm kind of new to VBA...
What do you mean by "if you ' or rem out both lines after the if statement."
What I'm trying to do is copy certain ranges based on wheter the selection is YES or NO, but after those ranges have been copied there is more code that follows and depends on the same selections- the issue is that after the first pass, the Macro is "defaulting" to the opposite answer of the drop down list.
Thank you
By placing rem or ' before code
the compiler will not prosess this.
By using there you can place comments in your code for making things easer to read for other, or for when you long forget what it is the code is doing
you have two if statements and after each of them you change the validation value.
That did it! THANK YOU!!! D_Rennie
You are welcome,
Be sure to mark the thread as solved.
Take a look at the forum rules to see how.
Have a good day.
The first post by D_Rennie was actually the solution - didn't figure it out right away. THANKS AGAIN!!!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks