Veiwports with TranslateCoordinates and CHSPACE

the code below will draw a viewport in paper space and zoom to an area in model space. It will then create a circle in model space and then change that circle to to papers pace while still keeping the circle in the same location. Note for this to work, the MSpace has to be … Continue reading Veiwports with TranslateCoordinates and CHSPACE

ByRef vs ByVal

When passing arguments to a procedure (sub or function) the default will be 'byRef' in Excel VBA, thus you don't have to write 'byRef' before the variable. If you want to pass ByVal you have to explicitly write 'ByVal' before the variable. When using ByVal you are only passing a copy of the argument to … Continue reading ByRef vs ByVal

Run a Macro at a Specific Time

Sub ImportModules() Debug.Print "test" End Sub Private Sub Workbook_Open() Application.OnTime Now + TimeValue("00:00:01"), "domeprog.ThisWorkbook.ImportModules" End Sub The code above will run the macro called 'ImportModules' one second after the workbook is opened. If the macro is located in a class module or in ThisWorkbook class, then you will need to call out the library + … Continue reading Run a Macro at a Specific Time

Clear All Check Boxes In Excel VBA Userform

This example uses a for each loop so that each check box name does not have to be explicitly written out. This is useful when you are adding more control and limit the amount of code you are writing. Better Method Dim ctrl As Control Sub ClearAllButton_Click() For Each ctrl In exportFilesUF.Controls If TypeName(ctrl) = … Continue reading Clear All Check Boxes In Excel VBA Userform