+ Reply to Thread
Results 1 to 2 of 2

No of rows as Range

  1. #1
    Registered User
    Join Date
    05-02-2005
    Posts
    3

    No of rows as Range

    Hi,
    I need to write the macro that calculate a function that should be fill all the rows with particular row.
    i include the coding.

    here the Range will be Range("G3:nRows")
    the nRows is the No. of rows with used cells(with contents)
    How to calculate the nRows??

    code::

    Sub CalculateTime()
    '
    ' CalculateTime Macro
    ' Macro recorded 3/2/2006 by Shah
    '
    Dim nRows As Long

    nRows = Application.ActiveSheet.UsedRange.Rows.Count
    '
    Range("G3").Select
    'nRows = ActiveSheet.UsedRange.Rows.Count
    'nRows = G2000

    ActiveCell.FormulaR1C1 = "=IF(RC[-4]=R[-1]C[-4],R[-1]C+150,61366)"
    Selection.AutoFill Destination:=Range("G3:nRows"), Type:=xlFillDefault
    ' Selection.AutoFill Destination:=Range("G3:G17750"), Type:=xlFillDefault
    ' Cells.Value
    'Range("G3:G28884").Select

    Range("G2").Select
    End Sub

  2. #2
    Bob Phillips
    Guest

    Re: No of rows as Range

    Sub CalculateTime()
    ' CalculateTime Macro
    ' Macro recorded 3/2/2006 by Shah
    Dim nRows As Long

    nRows = Application.ActiveSheet.UsedRange.Rows.Count
    '
    Range("G3").Select
    'nRows = ActiveSheet.UsedRange.Rows.Count
    'nRows = G2000

    ActiveCell.FormulaR1C1 = "=IF(RC[-4]=R[-1]C[-4],R[-1]C+150,61366)"
    Selection.AutoFill Destination:=Range("G3:G" & nRows), _
    Type:=xlFillDefault
    ' Selection.AutoFill Destination:=Range("G3:G17750"),
    ' Type:=xlFillDefault
    ' Cells.Value
    'Range("G3:G28884").Select

    Range("G2").Select
    End Sub



    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "zeeshah" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi,
    > I need to write the macro that calculate a function that should be fill
    > all the rows with particular row.
    > i include the coding.
    >
    > here the Range will be Range("G3:nRows")
    > the nRows is the No. of rows with used cells(with contents)
    > How to calculate the nRows??
    >
    > code::
    >
    > Sub CalculateTime()
    > '
    > ' CalculateTime Macro
    > ' Macro recorded 3/2/2006 by Shah
    > '
    > Dim nRows As Long
    >
    > nRows = Application.ActiveSheet.UsedRange.Rows.Count
    > '
    > Range("G3").Select
    > 'nRows = ActiveSheet.UsedRange.Rows.Count
    > 'nRows = G2000
    >
    > ActiveCell.FormulaR1C1 = "=IF(RC[-4]=R[-1]C[-4],R[-1]C+150,61366)"
    > Selection.AutoFill Destination:=Range("G3:nRows"),
    > Type:=xlFillDefault
    > ' Selection.AutoFill Destination:=Range("G3:G17750"),
    > Type:=xlFillDefault
    > ' Cells.Value
    > 'Range("G3:G28884").Select
    >
    > Range("G2").Select
    > End Sub
    >
    >
    > --
    > zeeshah
    > ------------------------------------------------------------------------
    > zeeshah's Profile:

    http://www.excelforum.com/member.php...o&userid=22867
    > View this thread: http://www.excelforum.com/showthread...hreadid=518138
    >




+ 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