Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by msmith

  1. msmith

    click on any control triggers event

    This may be too late to help, but there is a way to create a single event procedure for multiple controls. John Walkenbach explains how to do this on his "The Spreadsheet Page" website. Here is the link to the specific topic page: http://www.j-walk.com/ss/excel/tips/tip44.htm The example...
  2. msmith

    thread766-129558

    Upon testing, I determined a slightly different max length (109) using Excel 2003 but regardless of the exact value, I don't know of any way to change that. It's likely a limitation of Excel itself. Regards, Mike
  3. msmith

    Frustrated with If then else statement

    There is nothing wrong with your posted code, per se. I mocked this up and it worked as expected. The error you are getting indicates a problem with an object declaration/reference. I don't know what the rest of your worksheet and code looks like but my best guess is that MonthlyPayment is...
  4. msmith

    My first VBA Excel program doesn't port to new computer..

    Groundhog, Not to rain on your parade, but you might want to make sure those Visio dll's are legally redistributable. Should say so in the Visio documentation if they are. Regards, Mike
  5. msmith

    What does this mean..?

    Not exactly sure what you mean. If you are creating subroutines, they will be placed in whatever module you select. If you mean macro recorder code, these are typically added to a new module, even if one already exists. Event procedures, on the other hand, are created in the appropriate...
  6. msmith

    Checking if a file exists.

    Staying on the FileSystemObject bandwagon, the following will determine if a file exists: Set FSO = New FileSystemOBject If FSO.FileExists(FileSpec) Then ... where FileSpec is the path + filename you are checking. Regards, Mike
  7. msmith

    Checking if a file exists.

    mtroche, I'm assuming you mean folders (directories) not files. Your code works for me if the path c:\X already exists (and the optional attributes parameter of the Dir function is set to vbDirectory). Otherwise, the MkDir call throws the "Path not found" error. In other words, MkDir can...
  8. msmith

    FlexGrid Doesn't Work

    No, VBA does not include a design-time license for the component. However, your VBA application can still use the component but it must set any properties at run-time. I've used a DataGrid component in this fashion. Regards, Mike
  9. msmith

    Work sheet names and VBA macros in Excel

    Markus, If you have code like Worksheets("Sheet1").Range("A1") in your macros, and you change the worksheet tab from Sheet1 to Calculation your macro will certainly choke. However, you should be able to do a Find/Replace to make the process of changing the sheet name in your code somewhat less...
  10. msmith

    Work sheet names and VBA macros in Excel

    Markus, Yes! Many of the better Excel VBA programming books recommend this, since your macro code will break, otherwise, if the user changes a sheet tab name. Here's how: In the Visual Basic Editor (VBE), select the worksheet your macro code interacts with from the Project window. Notice...
  11. msmith

    String manipulation error

    I'll give you the "standard" answer but this may or may not be the problem. In the VBE, select Tools|References. In the dialog that displays you should see something like the following libraries checked (these are the minimum libraries that should be present): Visual Basic For Applications...
  12. msmith

    VBA ComboBox Problem?

    As an alternative, you can modify your ComboBox to have 2 columns (use the Properties window in the VBE and change the ColumnCount property to 2). Use the following modified code to populate the Combo: Private Sub UserForm_Initialize() With ComboBox1 .AddItem "Steel"...
  13. msmith

    Chdir returns error

    A couple of suggestions to try: Change the line DirPath = "K:\current\" + ResultsDatetoDirPath = "K:\current\" & ResultsDate & is the proper string concatenation operator in VBA Inspect ResultsDate (while single-stepping through the code) for extra spaces. If that's the case, you can remove...
  14. msmith

    Opening new workbooks in excel

    Expanding on cummings54's reply, here is some example code: Sub GetFile() Dim FPath As Variant Dim FFilter As String FFilter = "Comma Delimited (*.csv),*.csv" FPath = Application.GetOpenFilename(FFilter, , "Select File To Open", "Open") If FPath = False Then Exit Sub 'FPath contains...
  15. msmith

    "Find text" function

    ddaya, Here is a procedure that will do what you want (explanatory notes to follow): Const DATA_FIRST_ROW As Long = 2 Const DATA_ENTRY_COL As Integer = 1 Const DATA_CATEGORY_COL As Integer = 2 Const MAP_KEY_COL As Integer = 1 Const MAP_CATEGORY_COL As Integer = 2 Sub CategorizeFieldEntries()...

Part and Inventory Search