Closed Thread
Results 1 to 3 of 3

Insert dummy variables

  1. #1
    Chris_t_2k5
    Guest

    Insert dummy variables

    Hi, here is my problem. I will have data in different cells each time such
    as A1:C10, A1:H100, for example. What i need is macro that will insert a dash
    (-) under the last line of value in each cell.

    For example if there are values in cells A1:C10 I need a dash in each of the
    cells A11:C11.

    Thanks in advance

  2. #2
    Gary''s Student
    Guest

    RE: Insert dummy variables

    This will work for any table, even in the middle of a worksheet:


    Sub underline()
    Dim r, rr, rrr As Range

    Set r = Selection

    nLastRow = r.Rows.Count + r.Row
    nFirstColumn = r.Column
    nLastColumn = r.Columns.Count + r.Column - 1
    Set rr = Range(Cells(nLastRow, nFirstColumn), Cells(nLastRow, nLastColumn))

    For Each rrr In rr
    rrr.Value = "_"
    Next
    End Sub

    Just select the table and run the macro.
    --
    Gary's Student


    "Chris_t_2k5" wrote:

    > Hi, here is my problem. I will have data in different cells each time such
    > as A1:C10, A1:H100, for example. What i need is macro that will insert a dash
    > (-) under the last line of value in each cell.
    >
    > For example if there are values in cells A1:C10 I need a dash in each of the
    > cells A11:C11.
    >
    > Thanks in advance


  3. #3
    Tom Ogilvy
    Guest

    Re: Insert dummy variables

    Sub abc()
    Dim rng as Range, rw as Range
    Dim cell as Range
    Set rng = Range("A1").CurrentRegion
    Set rw = rng.Offset(rng.Rows.Count, 0).Resize(1)
    For Each cell In rw
    cell.Value = "-"
    Next
    End Sub

    --
    Regards,
    Tom Ogilvy


    "Chris_t_2k5" <Christ2k5@discussions.microsoft.com> wrote in message
    news:2A27B2C3-5C58-4B53-AE55-6E4548320BD1@microsoft.com...
    > Hi, here is my problem. I will have data in different cells each time

    such
    > as A1:C10, A1:H100, for example. What i need is macro that will insert a

    dash
    > (-) under the last line of value in each cell.
    >
    > For example if there are values in cells A1:C10 I need a dash in each of

    the
    > cells A11:C11.
    >
    > Thanks in advance




Closed 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