Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Danny
 
Posts: n/a
Default Highlight Range - wrong macro, please edit.

Hi,

I got this macro from this NG and I modified it to highlight a range.
However, it's not working. Please help.

Sub BordersBOLD()

Application.Goto Reference:="Applicants"
ActiveCell.Offset(1, 0).Select

With ActiveCell
ilastrow = Cells(Rows.Count, .Column).End(xlDown).Row
Set rng = .Resize(ilastrow - .Row + 1, 9)

'Then I will insert a macro here to make the outline borders bold.

End With
End Sub

  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default Highlight Range - wrong macro, please edit.

Danny,

In what way does it not work. It seems fine to me, and runs on my system
when I add some border code.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Danny" wrote in message
...
Hi,

I got this macro from this NG and I modified it to highlight a range.
However, it's not working. Please help.

Sub BordersBOLD()

Application.Goto Reference:="Applicants"
ActiveCell.Offset(1, 0).Select

With ActiveCell
ilastrow = Cells(Rows.Count, .Column).End(xlDown).Row
Set rng = .Resize(ilastrow - .Row + 1, 9)

'Then I will insert a macro here to make the outline borders bold.

End With
End Sub



  #3   Report Post  
Danny
 
Posts: n/a
Default Highlight Range - wrong macro, please edit.

Hi Bob,

I'm glad you responded because it was you that I got the macro. This time, I
modifed the macro to make the outline bold. Originally, when you gave me the
macro, I used it for sorting.

This time, the macro won't highlight the range!

Please help me again.

Thank you.

"Bob Phillips" wrote:

Danny,

In what way does it not work. It seems fine to me, and runs on my system
when I add some border code.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Danny" wrote in message
...
Hi,

I got this macro from this NG and I modified it to highlight a range.
However, it's not working. Please help.

Sub BordersBOLD()

Application.Goto Reference:="Applicants"
ActiveCell.Offset(1, 0).Select

With ActiveCell
ilastrow = Cells(Rows.Count, .Column).End(xlDown).Row
Set rng = .Resize(ilastrow - .Row + 1, 9)

'Then I will insert a macro here to make the outline borders bold.

End With
End Sub




  #4   Report Post  
Danny
 
Posts: n/a
Default Highlight Range - wrong macro, please edit.

Hi Bob,

It did it again. When you originally gave me the macro, it didn't work. I
re-typed it (not copying from the NG) and it worked. I did the same thing now
and it worked again. There's something wrong with my system.

Sorry,

"Danny" wrote:

Hi Bob,

I'm glad you responded because it was you that I got the macro. This time, I
modifed the macro to make the outline bold. Originally, when you gave me the
macro, I used it for sorting.

This time, the macro won't highlight the range!

Please help me again.

Thank you.

"Bob Phillips" wrote:

Danny,

In what way does it not work. It seems fine to me, and runs on my system
when I add some border code.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Danny" wrote in message
...
Hi,

I got this macro from this NG and I modified it to highlight a range.
However, it's not working. Please help.

Sub BordersBOLD()

Application.Goto Reference:="Applicants"
ActiveCell.Offset(1, 0).Select

With ActiveCell
ilastrow = Cells(Rows.Count, .Column).End(xlDown).Row
Set rng = .Resize(ilastrow - .Row + 1, 9)

'Then I will insert a macro here to make the outline borders bold.

End With
End Sub




  #5   Report Post  
Danny
 
Posts: n/a
Default Highlight Range - wrong macro, please edit.

Hi,

Now I know what's wrong. below is the complete macro to make the outline bold.


Sub BordersBOLD()

Application.Goto Reference:="Applicants"
ActiveCell.Offset(1, 0).Select

With ActiveCell
ilastrow = Cells(Rows.Count, .Column).End(xlDown).Row
Set rng = .Resize(ilastrow - .Row + 1, 9)


Range("B13:J55").Select

Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End With
End Sub

It only works on 'Range("B13:J55").Select

I was hoping that the macro would find any named range, move down one cell,
resize down to the last cell and 9 columns.

Please help.

"Danny" wrote:

Hi Bob,

It did it again. When you originally gave me the macro, it didn't work. I
re-typed it (not copying from the NG) and it worked. I did the same thing now
and it worked again. There's something wrong with my system.

Sorry,

"Danny" wrote:

Hi Bob,

I'm glad you responded because it was you that I got the macro. This time, I
modifed the macro to make the outline bold. Originally, when you gave me the
macro, I used it for sorting.

This time, the macro won't highlight the range!

Please help me again.

Thank you.

"Bob Phillips" wrote:

Danny,

In what way does it not work. It seems fine to me, and runs on my system
when I add some border code.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Danny" wrote in message
...
Hi,

I got this macro from this NG and I modified it to highlight a range.
However, it's not working. Please help.

Sub BordersBOLD()

Application.Goto Reference:="Applicants"
ActiveCell.Offset(1, 0).Select

With ActiveCell
ilastrow = Cells(Rows.Count, .Column).End(xlDown).Row
Set rng = .Resize(ilastrow - .Row + 1, 9)

'Then I will insert a macro here to make the outline borders bold.

End With
End Sub






  #6   Report Post  
Bob Phillips
 
Posts: n/a
Default Highlight Range - wrong macro, please edit.

Danny,

Is this what you want?

Sub BordersBOLD()
Dim iLastrow As Long
Dim rng As Range

Application.Goto Reference:="Applicants"
ActiveCell.Offset(1, 0).Select

With ActiveCell
iLastrow = Cells(Rows.Count, .Column).End(xlUp).Row
If iLastrow <= .Row Then Exit Sub
Set rng = .Resize(iLastrow - .Row + 1, 9)
End With

With rng
.Borders(xlDiagonalDown).LineStyle = xlNone
.Borders(xlDiagonalUp).LineStyle = xlNone
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With .Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End With
End Sub



--

HTH

RP
(remove nothere from the email address if mailing direct)


"Danny" wrote in message
...
Hi,

Now I know what's wrong. below is the complete macro to make the outline

bold.


Sub BordersBOLD()

Application.Goto Reference:="Applicants"
ActiveCell.Offset(1, 0).Select

With ActiveCell
ilastrow = Cells(Rows.Count, .Column).End(xlDown).Row
Set rng = .Resize(ilastrow - .Row + 1, 9)


Range("B13:J55").Select

Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End With
End Sub

It only works on 'Range("B13:J55").Select

I was hoping that the macro would find any named range, move down one

cell,
resize down to the last cell and 9 columns.

Please help.

"Danny" wrote:

Hi Bob,

It did it again. When you originally gave me the macro, it didn't work.

I
re-typed it (not copying from the NG) and it worked. I did the same

thing now
and it worked again. There's something wrong with my system.

Sorry,

"Danny" wrote:

Hi Bob,

I'm glad you responded because it was you that I got the macro. This

time, I
modifed the macro to make the outline bold. Originally, when you gave

me the
macro, I used it for sorting.

This time, the macro won't highlight the range!

Please help me again.

Thank you.

"Bob Phillips" wrote:

Danny,

In what way does it not work. It seems fine to me, and runs on my

system
when I add some border code.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Danny" wrote in message
...
Hi,

I got this macro from this NG and I modified it to highlight a

range.
However, it's not working. Please help.

Sub BordersBOLD()

Application.Goto Reference:="Applicants"
ActiveCell.Offset(1, 0).Select

With ActiveCell
ilastrow = Cells(Rows.Count, .Column).End(xlDown).Row
Set rng = .Resize(ilastrow - .Row + 1, 9)

'Then I will insert a macro here to make the outline borders bold.

End With
End Sub






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Name a Range - Macro Danny Excel Worksheet Functions 0 October 14th 05 05:24 AM
Macro to edit formula Tang123 Excel Discussion (Misc queries) 2 October 6th 05 08:33 PM
macro to copy and edit then delete a worksheet lschuh Excel Discussion (Misc queries) 13 July 27th 05 09:02 PM
variable range in a macro AMK Excel Discussion (Misc queries) 3 July 6th 05 09:32 AM


All times are GMT +1. The time now is 09:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"