Power Query Course in Spanish
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: here's a macro, needs a few adjustments...

  1. #1
    New Member
    Join Date
    Apr 2002
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Following is a very simple macro. All i need to know is how to re-write that so that when it has run, i can then apply it to the line that has been moved to (i.e. 417), or whatever line i want (not just 416).

    Range("B416:J416").Select
    Selection.Font.bold = True
    Range("B417").Select

    It has been suggested that a for loop would work, but i have no way of finding out how to do that.

    Thanks for your help if you can do it. If not, don't worry - i'm sure someone can...

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    =ActiveCell.Address
    Posts
    478
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Here's a few ideas that should get you started...

    'To do the current row
    Range("B" & ActiveCell.Row & ":J" & ActiveCell.Row).Font.Bold = True

    'To do a specified row, i.e. Row 417
    Dim MyRow As Integer
    MyRow = 417
    Range("B" & MyRow & ":J" & MyRow).Font.Bold = True

    'To do all rows in the sheet in a loop where
    'the value in column B is greater than zero
    Dim LastRow As Integer
    LastRow = Range("B65536").End(xlUp).Row
    For x = 1 To LastRow
    If Range("B" & x).Value > 0 Then
    Range("B" & x & ":J" & x).Font.Bold = True
    End If
    Next x


    Hope this helps
    AJ

  3. #3
    New Member
    Join Date
    Feb 2002
    Location
    Belgium
    Posts
    24
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hello,
    Try sth different, it will put in Bold a selection you manually and will then select the next row on the same first column.

    Selection.Font.Bold = True
    Cells(Selection.Rows(Selection.Rows.Count).Row + 1, Selection.Columns(1).Column).Select

    I hope it was what you wanted.
    Pierre

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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