Data Validation Formula changes to VBA Code
Closed
smuneeb
Posts
67
Registration date
Saturday 5 September 2015
Status
Member
Last seen
8 March 2017
-
7 Nov 2015 à 19:19
smuneeb Posts 67 Registration date Saturday 5 September 2015 Status Member Last seen 8 March 2017 - 9 Nov 2015 à 15:38
smuneeb Posts 67 Registration date Saturday 5 September 2015 Status Member Last seen 8 March 2017 - 9 Nov 2015 à 15:38
Related:
- Excel vba data validation
- Excel vba find - Guide
- How to copy data from one excel sheet to another - Guide
- How to open vba in excel - Guide
- Export data from excel - Guide
- Excel mod apk for pc - Download - Spreadsheets
1 response
rizvisa1
Posts
4478
Registration date
Thursday 28 January 2010
Status
Contributor
Last seen
5 May 2022
766
9 Nov 2015 à 09:41
9 Nov 2015 à 09:41
you need to understand the code to see what it is doing
This is a range
"D11:D510"
you cannot check range as "D11:D510").Value = "Best"
This is a range
"D11:D510"
you cannot check range as "D11:D510").Value = "Best"
9 Nov 2015 à 12:43
Thanks
9 Nov 2015 à 13:32
'The Me keyword behaves like an implicitly declared variable. It is automatically available to every procedure in a class module. When a class can have more than one instance, Me provides a way to refer to the specific instance of the class where the code is executing. Using Me is particularly useful for passing information about the currently executing instance of a class to a procedure in another module
'Range("D11:D510").Value = "Best" is checking if range value is equal to BEST. Think for a second. On excel sheet, would you ever say for a group of cells a singel value. I think you would say answer is NO. So what to do, would depends on what you want to check. You may want to check of each cell in range has that value or at least once cell has it etc.
So these lines will never work. you have to examine one cell at a time in a range
If (Me.Range("D11:D510").Value = "Best") Or (Me.Range("D11:D510").Value = "Worst") Then
I am not too sure what exactly and how exactly you are planning to use, Based on your previous questions, i thought you had the solution that you seek.
9 Nov 2015 à 14:00
In the end I perceived that I have to set Range as variable then call it for procedure
9 Nov 2015 à 15:18
1. You want to validate input in column B and E by checking value in column D
so if a cell in column D has "best" or "worst", then for that row, you want to clear out values from column B and Column E
Or is it some thing else
9 Nov 2015 à 15:38