![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Posts: 5
|
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 |
|
Board Regular
Join Date: Mar 2002
Location: =ActiveCell.Address
Posts: 478
|
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 |
|
New Member
Join Date: Feb 2002
Location: Belgium
Posts: 24
|
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 |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|