+ Reply to Thread
Page 4 of 4 FirstFirst ... 234
Results 46 to 57 of 57

Thread: Macro Distribution

  1. #46
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    mineral city, ohio
    MS-Off Ver
    Excel 2007; Excel 2000
    Posts
    4,004

    Re: Macro Distribution

    Great news (not about "Old and Grey") 'bout the Add-In. Frustrating "stuff", Add-Ins...wonderful tools. Need my input, holler.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  2. #47
    Forum Guru snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,151

    Re: Macro Distribution

    Mind the brackets; you don't need any variable:

    Sheets.Add(After:=Sheets(Sheets.Count))
    gives an error

    Sheets.Add ,Sheets(Sheets.Count)
    doesn't
    and MS invented With.... End With to prevent objectvariables and set statements (mind the brackets again):

    With Sheets.Add( ,Sheets(Sheets.Count))
      .name="example
      .visible=false
    end with
    Last edited by snb; 02-01-2011 at 03:31 PM.



  3. #48
    Registered User
    Join Date
    01-19-2011
    Location
    Houston, TX
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Macro Distribution

    OK, something else I am not finding
    ActiveWindow.SelectedSheets.Delete
    Causes a popup window to appear and ask if you really want to.
    Can I NOT have that popup window window appear?
    I tried adding False after it, it didn't like that.

  4. #49
    Forum Guru snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,151

    Re: Macro Distribution

    Application.displayalerts=false



  5. #50
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    mineral city, ohio
    MS-Off Ver
    Excel 2007; Excel 2000
    Posts
    4,004

    Re: Macro Distribution

    Set
    Application.displayalerts=false
    back to
    Application.displayalerts=True
    when finished with your delete.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  6. #51
    Registered User
    Join Date
    01-19-2011
    Location
    Houston, TX
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Macro Distribution

    man all these stupid little tweaks.

    I have a cell I need to copy to every cell in a column with data rows.
    How ever this column I am coping to, is empty.
    So I am doing a Range(Selection, Selection.End(xlDown)).Select
    and it copies it all the way to the bottom (1.5 million rows basically)
    How can I limit it to just the rows (in other cells) that have data.
    In my test spreadsheet, 1200 rows?

  7. #52
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    mineral city, ohio
    MS-Off Ver
    Excel 2007; Excel 2000
    Posts
    4,004

    Re: Macro Distribution

    Hi Fo_Fa

    Firstly, unless an issue is related to this Thread, you probably shouldn't be asking it in this Thread. Start a new one. You'll get hammered for this.

    Secondly, to address your question. Find the last row with data; this can be done several ways; these are JB's preferred methods
    'Check all rows
    LastRow = Cells.Find("*", Cells(Rows.Count, Columns.Count), SearchOrder:=xlByRows, _
        SearchDirection:=xlPrevious).Row
    or
    'Check one column specifically
    LastRow = Range("A" & Rows.Count).End(xlUp).Row
    or
    LR = ActiveSheet.Cells.Find("*", SearchOrder:=xlByRows, _
    SearchDirection:=xlPrevious).Row
    I prefer
    'Check one column specifically
    LastRow = Range("A" & Rows.Count).End(xlUp).Row
    when I KNOW what column has the last row of data I'm interested in.

    You can then do something like this
    Range("C2:C" & LR).PasteSpecial
    Mind you...you typically don't need "Select" in your code.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  8. #53
    Registered User
    Join Date
    08-04-2010
    Location
    SLC, UT
    MS-Off Ver
    Excel 2003, 2007
    Posts
    31

    Re: Macro Distribution

    This might be a bit of a long shot, but it works in a macro workbook I created for distribution to about 30 users. I wrote it in Excel 03, but it works fine in Excel 07.

    Sub Create_Menubar()
    
        Dim i As Long
    
        Dim mac_names As Variant
        Dim cap_names As Variant
        Dim tip_text As Variant
        Dim face_id As Variant
    
        On Error Resume Next
        Application.CommandBars("YourToolbarNameHere").Visible = True
        MyError = Err
        If MyError = 5 Then Application.CommandBars.Add(Name:="YourToolbarNameHere").Visible = True
        On Error GoTo 0
        
        Do Until Application.CommandBars("YourToolbarNameHere").Controls.Count = 0
            Application.CommandBars("YourToolbarNameHere").Controls(1).Delete
        Loop
    
        mac_names = Array(" * ")   '  * List your Macros here, each in quotes, separated by commas
    
        cap_names = Array(" * ")   ' * List the captions you want shown as you hover a mouse over the button, again in quotes, separated by commas
    
        face_id = Array( # )   '  # List the number of the Excel default face id options (see attached jpgs for options) you want for your macro buttons
    
        
        With Application.CommandBars("YourToolbarNameHere")
            For i = LBound(mac_names) To UBound(mac_names)
                With .Controls.Add(Type:=msoControlButton)
                    .OnAction = mac_names(i)
                    .Caption = cap_names(i)
                    .Style = msoButtonIcon
                    .FaceId = face_id(i)
                    .TooltipText = cap_names(i)
                End With
            Next i
        End With
         
    End Sub
    I'm not 100% certain that will work in an add-in file (works great in a regular xls or xlsb). Good luck.
    Attached Images Attached Images

  9. #54
    Registered User
    Join Date
    08-04-2010
    Location
    SLC, UT
    MS-Off Ver
    Excel 2003, 2007
    Posts
    31

    Re: Macro Distribution

    Additional Face Id's
    Attached Images Attached Images

  10. #55
    Registered User
    Join Date
    08-04-2010
    Location
    SLC, UT
    MS-Off Ver
    Excel 2003, 2007
    Posts
    31

    Re: Macro Distribution

    One more face id file
    Attached Images Attached Images

  11. #56
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    mineral city, ohio
    MS-Off Ver
    Excel 2007; Excel 2000
    Posts
    4,004

    Re: Macro Distribution

    Hi aclawson

    Sorry...I don't follow the connection...perhaps Fo_Fa does...
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  12. #57
    Registered User
    Join Date
    08-04-2010
    Location
    SLC, UT
    MS-Off Ver
    Excel 2003, 2007
    Posts
    31

    Re: Macro Distribution

    Sorry about the non-sequiter there. I was following the frist page of the thread (didn't see there were three more pages of back-and-forth after it). It was my attempt to help with the toolbar question Fo_Fa asked early in the thread.

    After I posted, I saw the end of the thread and realized I came in a bit behind the curve. Either way, it's been useful code to me.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0