![]() |
Syntax or Something is KILLING Me
Folks, call me stupid, call me an occassional VB player but I cannot figure
out what is happening. If I execute this statement: Sheets("Estimator").Range("E14").NumberFormatLocal = CurrFormat It works just fine. However, if I make things slightly more complex such as: Const WorkColEntry = "E" ComboRow = Str(ComboBox1.ListIndex) ' happens to be 14 Sheets("Estimator").Range(WorkColEntry + ComboRow).NumberFormatLocal = CurrFormat This statement blows up with an error: Run-time error 104, Application-defined or object-defined error, A very abstruse error definition I might add. In debug of the statement in question, WorkColEntry is "E" and ComboRow is "14". So what gives? It is 10:45 PM here in Singapore. To heck with this. Time for sleep and a game of golf tomorrow. |
Syntax or Something is KILLING Me
Should
Sheets("Estimator").Range(WorkColEntry + ComboRow).NumberFormatLocal = CurrFormat Sheets("Estimator").Range(WorkColEntry & ComboRow).NumberFormatLocal = CurrFormat -- p45cal "Strong Eagle" wrote: Folks, call me stupid, call me an occassional VB player but I cannot figure out what is happening. If I execute this statement: Sheets("Estimator").Range("E14").NumberFormatLocal = CurrFormat It works just fine. However, if I make things slightly more complex such as: Const WorkColEntry = "E" ComboRow = Str(ComboBox1.ListIndex) ' happens to be 14 Sheets("Estimator").Range(WorkColEntry + ComboRow).NumberFormatLocal = CurrFormat This statement blows up with an error: Run-time error 104, Application-defined or object-defined error, A very abstruse error definition I might add. In debug of the statement in question, WorkColEntry is "E" and ComboRow is "14". So what gives? It is 10:45 PM here in Singapore. To heck with this. Time for sleep and a game of golf tomorrow. |
Syntax or Something is KILLING Me
You need to use an ampersand instead of a + sign.
Sheets("Estimator").Range(WorkColEntry & comborow) _ .NumberFormatLocal = CurrFormat Strong Eagle wrote: Folks, call me stupid, call me an occassional VB player but I cannot figure out what is happening. If I execute this statement: Sheets("Estimator").Range("E14").NumberFormatLocal = CurrFormat It works just fine. However, if I make things slightly more complex such as: Const WorkColEntry = "E" ComboRow = Str(ComboBox1.ListIndex) ' happens to be 14 Sheets("Estimator").Range(WorkColEntry + ComboRow).NumberFormatLocal = CurrFormat This statement blows up with an error: Run-time error 104, Application-defined or object-defined error, A very abstruse error definition I might add. In debug of the statement in question, WorkColEntry is "E" and ComboRow is "14". So what gives? It is 10:45 PM here in Singapore. To heck with this. Time for sleep and a game of golf tomorrow. |
Syntax or Something is KILLING Me
No difference - same error with &
"p45cal" wrote: Should Sheets("Estimator").Range(WorkColEntry + ComboRow).NumberFormatLocal = CurrFormat Sheets("Estimator").Range(WorkColEntry & ComboRow).NumberFormatLocal = CurrFormat -- p45cal "Strong Eagle" wrote: Folks, call me stupid, call me an occassional VB player but I cannot figure out what is happening. If I execute this statement: Sheets("Estimator").Range("E14").NumberFormatLocal = CurrFormat It works just fine. However, if I make things slightly more complex such as: Const WorkColEntry = "E" ComboRow = Str(ComboBox1.ListIndex) ' happens to be 14 Sheets("Estimator").Range(WorkColEntry + ComboRow).NumberFormatLocal = CurrFormat This statement blows up with an error: Run-time error 104, Application-defined or object-defined error, A very abstruse error definition I might add. In debug of the statement in question, WorkColEntry is "E" and ComboRow is "14". So what gives? It is 10:45 PM here in Singapore. To heck with this. Time for sleep and a game of golf tomorrow. |
Syntax or Something is KILLING Me
better:
change ComboRow = Str(ComboBox1.ListIndex) to ComboRow = Trim(Str(ComboBox1.ListIndex)) -- p45cal "Strong Eagle" wrote: Folks, call me stupid, call me an occassional VB player but I cannot figure out what is happening. If I execute this statement: Sheets("Estimator").Range("E14").NumberFormatLocal = CurrFormat It works just fine. However, if I make things slightly more complex such as: Const WorkColEntry = "E" ComboRow = Str(ComboBox1.ListIndex) ' happens to be 14 Sheets("Estimator").Range(WorkColEntry + ComboRow).NumberFormatLocal = CurrFormat This statement blows up with an error: Run-time error 104, Application-defined or object-defined error, A very abstruse error definition I might add. In debug of the statement in question, WorkColEntry is "E" and ComboRow is "14". So what gives? It is 10:45 PM here in Singapore. To heck with this. Time for sleep and a game of golf tomorrow. |
Syntax or Something is KILLING Me
That worked. Now onto the next nightmare. Thanks for the assistance.
"p45cal" wrote: better: change ComboRow = Str(ComboBox1.ListIndex) to ComboRow = Trim(Str(ComboBox1.ListIndex)) -- p45cal "Strong Eagle" wrote: Folks, call me stupid, call me an occassional VB player but I cannot figure out what is happening. If I execute this statement: Sheets("Estimator").Range("E14").NumberFormatLocal = CurrFormat It works just fine. However, if I make things slightly more complex such as: Const WorkColEntry = "E" ComboRow = Str(ComboBox1.ListIndex) ' happens to be 14 Sheets("Estimator").Range(WorkColEntry + ComboRow).NumberFormatLocal = CurrFormat This statement blows up with an error: Run-time error 104, Application-defined or object-defined error, A very abstruse error definition I might add. In debug of the statement in question, WorkColEntry is "E" and ComboRow is "14". So what gives? It is 10:45 PM here in Singapore. To heck with this. Time for sleep and a game of golf tomorrow. |
All times are GMT +1. The time now is 05:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com