How to add Data Validation in a Cell using VBScript [closed] - excel

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 months ago.
Improve this question
I am trying to add Data Validation in an Excel Cell using VBScript but I can't figure the correct syntax. I can do it in VBA, it is not a problem, but I need to do it in VBScript.
I just need to Add Validation with Values: "Yes", "No" into the cell.
Relevant code:
Dim xlValidateList
xlValidateList = 3
For s = 2 to sheetCount
For r = 2 to sourceTotalRows
xlBookSource.Sheets(s).Cells(r,23).Validation.Add xlValidateList, "Yes,No"
Next
Next

Assuming the smart quotes are a typo, you have the formula as the wrong argument:
xlBookSource.Sheets(s).Cells(r,23).Validation.Add xlValidateList, , , "Yes,No"

Related

Adding the same cell onto itself in Excel [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 months ago.
Improve this question
I am trying to add two values from two cells , A & B and then update that in B. Basically, it is B=A+B. Is it possible in Excel? Using VBA?
Trying using like this
Sub Add()
Range("C9").Value = Range("C9").Value + Range("D9").Value
End Sub

To make height of rows from 2 to 50=118 using vba [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
What changes do i need to make in this code To make height of rows from 2 to 50=118
Sub Macro1()
Dim i As Integer
For i = 2 To 50
Rows("i:i").RowHeight = 118
Next i
End Sub
You don't need a loop, can do it in one fell swoop.
Rows("2:50").RowHeight = 118
In your code i was inside the quotes so the code was looking for row "i" which doesn't exist.
You could write
Rows(i & ":" & i).RowHeight = 118
but there doesn't seem much point.

If column contains Y concatenate headings [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
Got a list of data with 7 columns each with a Y in, I want to add a formula that will check for a Y in the column then concatenate the headings if correct and ignore if not.
See below example
Is this possible?
Try this User Defined Function.
=TextJoinIfs(", ", 0, 0, B$1:H$1, B2:H2, "y")
I did not get the TextJoinIfs to work, sadly, looks neat. If you have the same problem maybe this can be a solution. Not pretty I know...
=TEXTJOIN(",",TRUE,IF(IFERROR(MATCH("Y",A2),FALSE),"col 1",""),IF(IFERROR(MATCH("Y",B2),FALSE),"col 2",""),IF(IFERROR(MATCH("Y",C2),FALSE),"col 3",""),IF(IFERROR(MATCH("Y",D2),FALSE),"col 4",""),IF(IFERROR(MATCH("Y",E2),FALSE),"col 5",""),IF(IFERROR(MATCH("Y",F2),FALSE),"col 6",""),IF(IFERROR(MATCH("Y",G2),FALSE),"col 7",""),)

Problems with vlookup function in MS Excel [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
enter image description here[vlookup]
Erradic/inconsistent behavior with vlookup function in MS Excel.
The search list is in yellow, search result is in green.
Please refer to the captured image.
Help would be much appreciated.
Nothing is wrong with vlookup.
Vlookup will look in the first column for what you want, in this case it looks in column A for “round” and returns n/a which is perfectly correct.
You could 4 vlookups to deal with this or you can try index and match ...

Conditional results based on average found from other cells [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Rather than an Excel formula of this kind:
=IF(AVERAGE(A1:A4)<4,"POOR",IF(AVERAGE(A1:A4)<5,"Meet Expectation",IF(AVERAGE(A1:A4)<7,"Good",IF(AVERAGE(A1:A4)<8,"Excellent","Outstan‌​ding"))))
how might I achieve similar results with a lookup table?
With a lookup table (and without requiring an exact match):
Where an exacct match is not found it defaults to the next lower matching value. 9 can not be found but 8 can be, hence Outstanding. You have not been specific about the breakpoints (eg 5 seems to be both Meet Expectation and Good) but the table is easy to adjust to suit by adding or deducting a very small amount to the number to the left of Good.
The table is here named Qarray and can be placed anywhere in the same workbook if the named range is of Workbook scope.
Formula:
=IF(A1<4,"POOR",IF(AND(A1>=4,A1<5),"Meets Expectations",IF(AND(A1>=5,A1<7),"Good",IF(AND(A1>=7,A1<8),"Excellent","Outstanding"))))

Resources