Mistborn
asked on
SendKeys Question
I have inherited a worksheet that has some macros that were coded in Excel 2003 and uses the line
SendKeys "+{TAB}", -1
I am using Excel 2010 now and the code is malfunctioning and I belive it has to do with that line. I belive the +Tab is to shift to the next cell to the left but I do not know what the -1 is for. I have tried searching for what the -1 is supposed to do but cannot find it. Can anyone tell me what it is for? Thanks!
SendKeys "+{TAB}", -1
I am using Excel 2010 now and the code is malfunctioning and I belive it has to do with that line. I belive the +Tab is to shift to the next cell to the left but I do not know what the -1 is for. I have tried searching for what the -1 is supposed to do but cannot find it. Can anyone tell me what it is for? Thanks!
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
It has to be 0 or 1 and not -1
or best to use True/False
Change the code to
SendKeys "+{TAB}", True
Sid
or best to use True/False
Change the code to
SendKeys "+{TAB}", True
Sid
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
You are welcome :)
Sid
Sid
ASKER
Copying the help file didn't really help at all.
Mistborn,
It appears that you resolved the problem yourself, albeit with some help from the Experts, and so while your comment will be marked with the answer Sid and rorya will share in the points.
In any event, the original C grade was wholly unwarranted; it should typically be reserved for cases where the Expert(s) gave vague and incomplete answers and then failed to reply to reasonable requests for clarification.
FWIW, I know a thing ir two about Excel, and rorya's advice to avoid SendKeys is best practice. Also, -1 does NOT convert to False in VBA. -1 is boolean True, 0 is boolean False, and in a type conversion any non-zero numeric value converts to the True.
modus_operandi
EE Admin
It appears that you resolved the problem yourself, albeit with some help from the Experts, and so while your comment will be marked with the answer Sid and rorya will share in the points.
In any event, the original C grade was wholly unwarranted; it should typically be reserved for cases where the Expert(s) gave vague and incomplete answers and then failed to reply to reasonable requests for clarification.
FWIW, I know a thing ir two about Excel, and rorya's advice to avoid SendKeys is best practice. Also, -1 does NOT convert to False in VBA. -1 is boolean True, 0 is boolean False, and in a type conversion any non-zero numeric value converts to the True.
modus_operandi
EE Admin
ASKER