Excel Question (Data Validation)

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Excel Question (Data Validation)

Re: Excel Question (Data Validation)

Post by mick3 » 28 Sep 2019, 04:59

Wow... Thank you very much!!!

Re: Excel Question (Data Validation)

Post by nitrofenix » 20 Sep 2019, 22:53

mick3 wrote:
16 Sep 2019, 10:31
i want this code in AHK But i can't find 'With' statement in AHK
What should I do?
You don't really need it -- what you do need is to enumerate xlValidateList, xlValidAlertStop and xlEqual (or have variables/constants for them):

Code: Select all

F1::
xl:=ComObjActive("Excel.Application")
xl.Visible := True
; xlValidateList = 3
; xlValidAlertStop = 1
; xlEqual = 3
xl.Selection.Validation.Add[Type:=3,AlertStyle:=1,Operator:=3, Formula1:="A, B"]
return

Re: Excel Question (Data Validation)

Post by mick3 » 16 Sep 2019, 10:31

This is VBA data Validation
--
With Selection.Validation
.Add Type:=xlValidateList, _
AlertStyle:=xlValidAlertStop, _
Operator:=xlEqual, Formula1:="A, B"
End With
--

i want this code in AHK But i can't find 'With' statement in AHK
What should I do?

i write AHK code like this
F1::
xl:=ComObjActive("Excel.Application")
xl.Visible := True
xl.With Selection.Validation
xl.Add Type:=xlValidateList, _
AlertStyle:=xlValidAlertStop, _
Operator:=xlEqual, Formula1:="A, B"
xl.End With
return

But this code occur compile error :(
What should I do?

Re: Excel Question (Data Validation)

Post by Guest10 » 27 Feb 2014, 14:42

thanks, someone suggested to create a range (X1:X10), which is allowed, and then associate the cells in this range to target random cells (A3,B5,C7,...) in the worksheet ~ :geek:

Re: Excel Question (Data Validation)

Post by tank » 27 Feb 2014, 14:16

well you could use some vba macros but i was offering simple workaround

Re: Excel Question (Data Validation)

Post by Guest10 » 27 Feb 2014, 13:19

tank wrote:so basically you want to choose a random cell from a list =INDEX(A1:A14,RANDBETWEEN(ROW(A1),ROW(A14)))
you could use columns instead. but you could use that to create random values from another range of cells in each of the cells in your list.
That isnt doing it for you but maybe it sparks an idea
thanks, so basically i am not allowed to pick random values from other cells directly (=A3,=B5,=C7, ...) but i could use your workaround for the same end result ~ :)

Re: Excel Question (Data Validation)

Post by tank » 27 Feb 2014, 12:26

so basically you want to choose a random cell from a list =INDEX(A1:A14,RANDBETWEEN(ROW(A1),ROW(A14)))
you could use columns instead. but you could use that to create random values from another range of cells in each of the cells in your list.
That isnt doing it for you but maybe it sparks an idea

Excel Question (Data Validation)

Post by Guest10 » 24 Feb 2014, 22:58

i would like to perform the following in Excel:
Data > Validation > Data Validation > Allow List > Data
in Data field i would like to create a list of values to pick values of other cells. for example, A1, B2, C3, etc. however, this does not work: =A1,=B2,=C3, ... i know, however, a range works such as =A1:A10. but i would like to pick random values from other cells not a range: =A1,=A3,=A5, ... (this never works!). P.S.: Of course an easy/typical application of a list is a simple string of values: apples,oranges,grapes,bananas, ... but I would like to pick values of other random cells.

Top