Consulting

Results 1 to 4 of 4

Thread: Solved: Running an application at each blank row.

  1. #1
    VBAX Contributor
    Joined
    Nov 2012
    Location
    Billericay, Essex
    Posts
    145
    Location

    Solved: Running an application at each blank row.

    Hi,
    I have a spread sheet with rows that are blank except for column "G" which has a formula. These rows are between various size groups of rows.
    I want to select the cell in column "C" above each blank row and then run a VBA application called Add_Holdings ()
    The data is across 15 columns some of which can be empty and about 150 rows.
    I was working along the lines of:

    [VBA] With ActiveSheet.UsedRange
    .AutoFilter Field:=1, Criteria1:=""
    ActiveCell.Offset(-1, 2).Select
    Application.Run "Add_Holdings"
    .AutoFilter
    End With
    [/VBA]
    But nowhere near getting it to work.
    I am working with Windows Home Premium version 6.1.7601 SP 1 Build7601and Excel version 14.0.6123.5001 (32 bit)
    any help would be much appreciated



    Regards, Peter.

  2. #2
    VBAX Tutor david000's Avatar
    Joined
    Mar 2007
    Location
    Chicago
    Posts
    276
    Location
    [VBA]
    Sub a()
    Dim rng As Range
    Set rng = Intersect(Range("C:C"), ActiveSheet.UsedRange)
    rng.SpecialCells(xlCellTypeBlanks).Offset(-1).Select
    End Sub
    [/VBA]
    Last edited by david000; 12-23-2012 at 07:24 PM.
    "To a man with a hammer everything looks like a nail." - Mark Twain

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    To avoid error if C1 is blank
    [VBA] Set rng = Intersect(Range("C:C"), ActiveSheet.UsedRange).Offset(1)[/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  4. #4
    VBAX Contributor
    Joined
    Nov 2012
    Location
    Billericay, Essex
    Posts
    145
    Location
    Thank you both, brilliant short code, this site is awesome!
    Regards, Peter.

Posting Permissions

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