Posts by btadams

    Re: Docking A Custom Toolbar


    Take a look at the Position property in Help:

    Code
    1. For Each bar In CommandBars
    2. If bar.Visible = True Then
    3. If bar.BuiltIn Then
    4. bar.Position = msoBarTop
    5. Else
    6. bar.Position = msoBarBottom
    7. End If
    8. End If
    9. Next

    Re: Hide a row before printing based on a cell value


    Maybe this will do (but it doesn't do anything if B30 =1):


    Re: Override Alert Message Text


    As far as I know there is no way to override that message. You can either password protect the sheet to keep users from unprotecting it, or you might turn off protection altogether and use a macro such as this in the worksheet code module:


    Code
    1. Private Sub Worksheet_Change(ByVal Target As Range)
    2. Application.EnableEvents = False
    3. Application.Undo
    4. Application.EnableEvents = True
    5. End Sub

    Re: Vba To Insert Command Button


    Here's some code generated with the macro recorder with some minor changes:


    Re: Two Worksheet_selectionchange


    Unless I'm missing something (and everyone says I am), it looks like you could combine all of that code within the same SelectionChange event. Just remove the extra


    Code
    1. If Target.Cells.Count > 1 Then Exit Sub

    Re: Select A Range With VBA


    Or this:


    Code
    1. Range(Cells(15, 1), Cells(15, 1).End(xlDown)).Select
    2. Selection.Resize(Selection.Rows.Count - 1, Selection.Columns.Count).Select

    in the file that has first/last names in separate columns you could combine them by inserting a new column and entering the formula =A2&" "&B2 where A2 has first name and B2 has last name. Then before deleting the columns A & B, you'll need to select all of the column containing the formula (click on the column header letter), click your copy button and then go to Edit -> Paste Special and click the Values button and OK. This will change the formulas to values and you can then delete columns A & B


    Then insert or delete columns where you need to in order that both files have equal number of columns in same order.


    Then select all the data in one worksheet (use the Ctrl + Shift +Arrow keys simultaneously to select in a certain direction) and copy/paste it at the bottom of the other worksheet. Then you can select all the columns with data and go to the Data menu and choose Sort. Sort by the column with names. Then you can get rid of duplicates by going to Data -> Filter -> Advanced Filter. Select your entire database and choose to paste it to another location and check off the Unique Records Only checkbox

    you could put some code in the Workbook_Open event:


    Private Sub Workbook_Open()
    Range("A1").value = Range("A1").value + 1
    End Sub


    To enter this, right-mouse click on the Excel icon next to the File menu and choose View Code

    try this:


    Sub DleteDups()
    Dim Cell As Range


    Do While ActiveCell.Offset(1, 0) <> ""
    If ActiveCell.Value <> ActiveCell.Offset(1, 0).Value Then
    ActiveCell.Offset(1, 0).Select
    Else
    ActiveCell.EntireRow.Delete
    End If
    Loop
    End Sub

    Lynda,


    there is a function that comes with the Analysis Toolpak add-in that does exactly what you want called WORKDAY. To load the add-in go to the Tools menu and select Add-Ins... and check off the Analysis Toolpak and Analysis Toolpak VBA boxes. Then in the Date & Time category you will find WORKDAY. It automatically skips weekends and optionally any holidays you supply.