+ Reply to Thread
Results 1 to 4 of 4

changing rows for columns

  1. #1
    Registered User
    Join Date
    09-29-2005
    Posts
    28

    changing rows for columns

    This peice of code goes all the way across the workbook an changes white blank columns to white columns with IN written on it.

    Can anyone adapt this code so that it goes down a column rather than across a row, i tried changing the words Row to Column but that didn't work!


    VBA:

    Sub Macro_In()
    Dim c As Range

    For Each c In Range(Cells(ActiveCell.Row, 4), Cells(ActiveCell.Row, 56))
    If c.Interior.ColorIndex = 2 Or c.Interior.ColorIndex < 0 And Len(c) = 0 And c.FormulaR1C1 = "" Then
    c = "IN"
    End If

    Next c

    End Sub

  2. #2
    Executor
    Guest

    Re: changing rows for columns

    Hi,

    You are close to the wanted code:

    Sub Macro_In()
    Dim c As Range

    For Each c In Range(Cells(4, ActiveCell.Column), Cells(56,
    ActiveCell.Column))
    If c.Interior.ColorIndex =3D 2 Or c.Interior.ColorIndex < 0 And
    Len(c) =3D 0 And c.FormulaR1C1 =3D "" Then
    c =3D "IN"
    End If
    Next c

    End Sub


    Hoop That Helps,


    Wouter Magr=E9


  3. #3
    Registered User
    Join Date
    09-29-2005
    Posts
    28

    declaring active cell as start point?

    Coll, that works well good, but is there a way instead of it always being cell 4 to cell 56 that gets changed is there a way to declare the first cell as the active cell and then do it from there until cell 56?

    So if i was on E25 and i ran the macro i'd want all the cells below E25, so up to E56 to change but i'd have to declare that cell E25 was the start cell.

    Is this possible? and if so how would i go about altering the code to incorporate it?

  4. #4
    Tom Ogilvy
    Guest

    Re: changing rows for columns

    For Each c In Range(Cells(4, ActiveCell.Column), _
    Cells(56,ActiveCell.Column))

    would become

    For Each c In Range(AcitiveCell, Cells(56, _
    ActiveCell.Column))

    --
    Regards,
    Tom Ogilvy

    "alymcmorland" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > Coll, that works well good, but is there a way instead of it always
    > being cell 4 to cell 56 that gets changed is there a way to declare the
    > first cell as the active cell and then do it from there until cell 56?
    >
    > So if i was on E25 and i ran the macro i'd want all the cells below
    > E25, so up to E56 to change but i'd have to declare that cell E25 was
    > the start cell.
    >
    > Is this possible? and if so how would i go about altering the code to
    > incorporate it?
    >
    >
    > --
    > alymcmorland
    > ------------------------------------------------------------------------
    > alymcmorland's Profile:

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




+ 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