+ Reply to Thread
Results 1 to 2 of 2

Applying macro within a custom macro button to all workbooks

  1. #1
    Registered User
    Join Date
    02-02-2005
    Posts
    11
    Quote Originally Posted by Ron Coderre
    Hi, BigBas

    I have a couple suggestions...

    First, if it isn't already, the DeleteBlankRows code should be in a General Module in your Personal.xls. That way, it will be available to ALL workbooks.

    Second, I'd use slightly more durable and efficient code. There's no need to start at the absolute bottom of the sheet if the used range only extends to Row_45, right?

    Please Login or Register  to view this content.
    Does that help?
    Hi Ron,
    I'm amazed at your skill in writing tight code! I'm quite weak at vba in general and have a need to perform a routine for which I'm able to code, but I need to apply it only to the active sheet.

    I've studied the code you gave BigBas. If I understand it, lngEndRow (what's lng?) is the last row of the active sheet and lngCtr is a counter that starts at the last row and goes through row three (I presume the first two rows are header). What I'm quite murky about is the if statement and the following one. I don't understand what the "3" is in either one of them.

    Btw, the routine I'm working on is to sort a sheet of a couple hundred lines after first removing all hard page breaks and then inserting them back in the new sort where they belong at the beginning of each of a dozen or two groups.

    Thanks for sharing your expertise!

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    lng is a prefix used to denote a Long, as str could be used when naming a String or int before an Integer. Read this for a fuller explanation of naming principles.

    http://www.excel-it.com/clear_code.htm

    The three is used to determine the Column number for the Range, eg Cells(1,3) would be C1. So Ron's code is the going through the cells in C stepping by the Row defined as lngCtr starting from the last cell with data.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.6.0 RC 1