ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Running Standard Module Code from Dataform (https://www.excelbanter.com/excel-programming/341452-running-standard-module-code-dataform.html)

Jim May

Running Standard Module Code from Dataform
 
From a command button on a dataform the "on click" event,
can I run code from a Standard module?

Totally, separate Q:
In a standard module
where I use
Dim LrowS2 as Integer
and later in the code I have a line:
LrowS2 = Range("B65356").end(xlUp).row

I get compile error at this point, with explanation of:
Statement Invalid outside Type Block..
???? Not a clue here....




Tom Ogilvy

Running Standard Module Code from Dataform
 
If you mean userform, no. You can call the procedure in the general module
from the click event of the button.

the line of code works fine, so it must have something to do with the
context of the statement.

Not a factor, but
You might declare LrowS2 as long as you gain nothing by declaring it as
Integer and Integer can not hold a number as large as 65536 (and you have
65356).

--
Regards,
Tom Ogilvy

"Jim May" wrote in message
...
From a command button on a dataform the "on click" event,
can I run code from a Standard module?

Totally, separate Q:
In a standard module
where I use
Dim LrowS2 as Integer
and later in the code I have a line:
LrowS2 = Range("B65356").end(xlUp).row

I get compile error at this point, with explanation of:
Statement Invalid outside Type Block..
???? Not a clue here....







All times are GMT +1. The time now is 05:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com