ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   If, then bold row (https://www.excelbanter.com/excel-discussion-misc-queries/245950-if-then-bold-row.html)

puiuluipui

If, then bold row
 
Hi, i need a macro to bold a row or a range in that row(A:J) if in column A
the macro finds "Nr. Crt.".
Can this be done?
Thanks!

Jacob Skaria

If, then bold row
 
Try the below....

Sub Macro()
Dim varFound As Variant, varSearch As Variant, strAddress As String

varSearch = "Nr. Crt."
ActiveSheet.Range("A:A").Font.Bold = False
With ActiveSheet.Columns(1)
Set varFound = .Find(varSearch, LookIn:=xlValues)
If Not varFound Is Nothing Then
strAddress = varFound.Address
Do
varFound.Resize(, 10).Font.Bold = True
Set varFound = .FindNext(varFound)
Loop While Not varFound Is Nothing And _
varFound.Address < strAddress
End If
End With
End Sub


If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi, i need a macro to bold a row or a range in that row(A:J) if in column A
the macro finds "Nr. Crt.".
Can this be done?
Thanks!


puiuluipui

If, then bold row
 
Hi Jacob, it's working, but can you make this code to highlight that row? (to
bold and highlight)?
Thanks!

"Jacob Skaria" a scris:

Try the below....

Sub Macro()
Dim varFound As Variant, varSearch As Variant, strAddress As String

varSearch = "Nr. Crt."
ActiveSheet.Range("A:A").Font.Bold = False
With ActiveSheet.Columns(1)
Set varFound = .Find(varSearch, LookIn:=xlValues)
If Not varFound Is Nothing Then
strAddress = varFound.Address
Do
varFound.Resize(, 10).Font.Bold = True
Set varFound = .FindNext(varFound)
Loop While Not varFound Is Nothing And _
varFound.Address < strAddress
End If
End With
End Sub


If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi, i need a macro to bold a row or a range in that row(A:J) if in column A
the macro finds "Nr. Crt.".
Can this be done?
Thanks!


Jacob Skaria

If, then bold row
 
Try..

Sub Macro()
Dim varFound As Variant, varSearch As Variant, strAddress As String

varSearch = "Nr. Crt."
ActiveSheet.Range("A:J").Font.Bold = False
ActiveSheet.Range("A:J").Interior.ColorIndex = xlNone
With ActiveSheet.Columns(1)
Set varFound = .Find(varSearch, LookIn:=xlValues)
If Not varFound Is Nothing Then
strAddress = varFound.Address
Do
varFound.Resize(, 10).Font.Bold = True
varFound.Resize(, 10).Interior.ColorIndex = 6
Set varFound = .FindNext(varFound)
Loop While Not varFound Is Nothing And _
varFound.Address < strAddress
End If
End With
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi Jacob, it's working, but can you make this code to highlight that row? (to
bold and highlight)?
Thanks!

"Jacob Skaria" a scris:

Try the below....

Sub Macro()
Dim varFound As Variant, varSearch As Variant, strAddress As String

varSearch = "Nr. Crt."
ActiveSheet.Range("A:A").Font.Bold = False
With ActiveSheet.Columns(1)
Set varFound = .Find(varSearch, LookIn:=xlValues)
If Not varFound Is Nothing Then
strAddress = varFound.Address
Do
varFound.Resize(, 10).Font.Bold = True
Set varFound = .FindNext(varFound)
Loop While Not varFound Is Nothing And _
varFound.Address < strAddress
End If
End With
End Sub


If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi, i need a macro to bold a row or a range in that row(A:J) if in column A
the macro finds "Nr. Crt.".
Can this be done?
Thanks!


puiuluipui

If, then bold row
 
It's working perfect!
Thanks!

"Jacob Skaria" a scris:

Try..

Sub Macro()
Dim varFound As Variant, varSearch As Variant, strAddress As String

varSearch = "Nr. Crt."
ActiveSheet.Range("A:J").Font.Bold = False
ActiveSheet.Range("A:J").Interior.ColorIndex = xlNone
With ActiveSheet.Columns(1)
Set varFound = .Find(varSearch, LookIn:=xlValues)
If Not varFound Is Nothing Then
strAddress = varFound.Address
Do
varFound.Resize(, 10).Font.Bold = True
varFound.Resize(, 10).Interior.ColorIndex = 6
Set varFound = .FindNext(varFound)
Loop While Not varFound Is Nothing And _
varFound.Address < strAddress
End If
End With
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi Jacob, it's working, but can you make this code to highlight that row? (to
bold and highlight)?
Thanks!

"Jacob Skaria" a scris:

Try the below....

Sub Macro()
Dim varFound As Variant, varSearch As Variant, strAddress As String

varSearch = "Nr. Crt."
ActiveSheet.Range("A:A").Font.Bold = False
With ActiveSheet.Columns(1)
Set varFound = .Find(varSearch, LookIn:=xlValues)
If Not varFound Is Nothing Then
strAddress = varFound.Address
Do
varFound.Resize(, 10).Font.Bold = True
Set varFound = .FindNext(varFound)
Loop While Not varFound Is Nothing And _
varFound.Address < strAddress
End If
End With
End Sub


If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi, i need a macro to bold a row or a range in that row(A:J) if in column A
the macro finds "Nr. Crt.".
Can this be done?
Thanks!



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

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