ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   With Statement (https://www.excelbanter.com/excel-programming/321627-statement.html)

Kevin H. Stecyk[_2_]

With Statement
 
Hi,

I am doing something incorrect.

With Range("$A$3")
..Text = "Current Configuration"
..Font.Bold = True
..HorizontalAlignment = xlLeft
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
End With

When the cursor hits the Text line, it crashes with "Run-time error '424':
Object required.

What am I doing wrong.

Also, can I nest a With Statement within a With Statement?

Thank you.

Regards,
Kevin



Rob van Gelder[_4_]

With Statement
 
..Text is read-only for a Range.

Try .Value = instead

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Kevin H. Stecyk" wrote in message
...
Hi,

I am doing something incorrect.

With Range("$A$3")
.Text = "Current Configuration"
.Font.Bold = True
.HorizontalAlignment = xlLeft
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
End With

When the cursor hits the Text line, it crashes with "Run-time error '424':
Object required.

What am I doing wrong.

Also, can I nest a With Statement within a With Statement?

Thank you.

Regards,
Kevin




Chip[_3_]

With Statement
 
Range("$C$5").Select
ActiveCell.Value = "Current Configuration"

With Selection
..Font.Bold = True
..HorizontalAlignment = xlLeft
With .Borders(xlEdgeRight)
..LineStyle = xlContinuous
..Weight = xlMedium
..ColorIndex = xlAutomatic
End With
End With


Kevin H. Stecyk[_2_]

With Statement
 
Rob van Gelder wrote...
.Text is read-only for a Range.

Try .Value = instead

--
Rob van Gelder - http://www.vangelder.co.nz/excel


Thank you very much Rob.

Best regards,
Kevin



Kevin H. Stecyk[_2_]

With Statement
 
Chip wrote in message ...
Range("$C$5").Select
ActiveCell.Value = "Current Configuration"

With Selection
.Font.Bold = True
.HorizontalAlignment = xlLeft
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
End With


Thank you very much Chip.

Best regards,
Kevin




All times are GMT +1. The time now is 06:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com