+ Reply to Thread
Results 1 to 2 of 2

Excel VBA - How do I make the third column in a row the active cel

  1. #1
    BrianW
    Guest

    Excel VBA - How do I make the third column in a row the active cel

    Hi there
    I want to create a macro that will select column C as my active cell
    regardless of where my cursor is in that row.
    For example, the cell I may have selected is say BB300 or G300 or Z300. When
    I run my macro I want to select column "C" as my active cell so that I can
    then select cells C300-G300 for custom formatting.
    TIA

  2. #2
    Toppers
    Guest

    RE: Excel VBA - How do I make the third column in a row the active

    Brian,
    To avoid the select, your code could be amended to:

    With Range(ActiveCell, ActiveCell.Offset(0, 10))
    .Interior.ColorIndex = 37
    .Interior.Pattern = xlSolid
    .Font.ColorIndex = 3
    .Font.Bold = True
    End With

    "BrianW" wrote:

    > Hi Toppers
    > Thanks for that. Here is my currant macro
    > Range(ActiveCell, ActiveCell.Offset(0, 10)).Select
    >
    > With Selection.Interior
    > .ColorIndex = 37
    > .Pattern = xlSolid
    > End With
    > Selection.Font.ColorIndex = 3
    > Selection.Font.Bold = True
    >
    > I'll add your code and see how I go.
    > Cheers
    > Brian
    >
    >
    > "Toppers" wrote:
    >
    > > Brian,
    > > Assuming the active cell is (somewhere) in the row requiring
    > > formatting then you could use:
    > >
    > > Range("C" & ActiveCell.Row & ":G" & ActiveCell.Row).NumberFormat =
    > > "dd/mm/yyyy" ' <==== set as a date format
    > >
    > > Avoid selecting if possible as it is inefficient.
    > >
    > > HTH
    > >
    > > "BrianW" wrote:
    > >
    > > > Hi there
    > > > I want to create a macro that will select column C as my active cell
    > > > regardless of where my cursor is in that row.
    > > > For example, the cell I may have selected is say BB300 or G300 or Z300. When
    > > > I run my macro I want to select column "C" as my active cell so that I can
    > > > then select cells C300-G300 for custom formatting.
    > > > TIA


+ 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