Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Search column...change row to BOLD

I'm an amateur excel user and I've just taught myself how to create a macro.
I have a bid program that I export a summary sheet to excel. I've set up a
macro to format column widths and column colors. I want to add to this macro
to search column A for WHOLE numbers. If the cell in column A is a whole
number, then I want to change that row to bold. Help please?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Search column...change row to BOLD

I took the time to clean up your recorded macro to remove selections, etc
Use this to bold your integer rows. To incorporate into the other use

boldintgers
as the last line before end sub in the merge_cells macro

Sub boldintegers()
mc = 1 'col A
For i = 1 To Cells(Rows.Count, mc).End(xlUp).Row
mv = Cells(i, mc)
If Len(Application.Trim(mv)) 0 _
And mv = Int(mv) Then
'MsgBox i
Rows(i).Font.Bold = True
End If
Next
End Sub

Sub Merge_Cells()
'I REALLY do NOT recommend MERGING CELLS. Use center across
Columns("C:D").Delete
Rows("2:2").Insert Shift:=xlDown
With Range("A1:A2,c1:d2,f1:m2")
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Columns("A").ColumnWidth = 7.57
Columns("B").ColumnWidth = 35.29
Columns("C").ColumnWidth = 12.14
Columns("D").ColumnWidth = 6.71
Columns("E").ColumnWidth = 10.43
Columns("F").ColumnWidth = 14
Columns("G").ColumnWidth = 11.43
Columns("H").ColumnWidth = 12.71
Columns("I").ColumnWidth = 11.71
Columns("J").ColumnWidth = 12
Columns("K").ColumnWidth = 15
Columns("L").ColumnWidth = 17.57
Columns("M").ColumnWidth = 13.14
Columns("N").ColumnWidth = 11.86
Columns("N").Interior.ColorIndex = 36
Columns("L").Interior.ColorIndex = 34

'REALLY slows things down so
'comment out or delete changes not necessary
'or UN comment what I commented
With ActiveSheet.PageSetup
'.PrintTitleRows = ""
'.PrintTitleColumns = ""
'.PrintArea = ""

'.LeftHeader = ""
'.CenterHeader = ""
'.RightHeader = ""
'.LeftFooter = ""
'.CenterFooter = ""
'.RightFooter = ""
'.LeftMargin = Application.InchesToPoints(0.75)
'.RightMargin = Application.InchesToPoints(0.75)
'.TopMargin = Application.InchesToPoints(1)
'.BottomMargin = Application.InchesToPoints(1)
'.HeaderMargin = Application.InchesToPoints(0.5)
'.FooterMargin = Application.InchesToPoints(0.5)
'.PrintHeadings = False
'.PrintGridlines = False
'.PrintComments = xlPrintNoComments
'.PrintQuality = 600
'.CenterHorizontally = False
'.CenterVertically = False

.Orientation = xlLandscape

'.Draft = False
.PaperSize = xlPaper11x17

'.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver

'.BlackAndWhite = False
'.Zoom = 100
'.PrintErrors = xlPrintErrorsDisplayed
End With
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike" wrote in message
...
Don, Here's the macro I have set up so far.
Sub Merge_Cells()
'
' Merge_Cells Macro
' Merge Cells for Cost Summary
'

'
Columns("C:D").Select
Selection.Delete Shift:=xlToLeft
Rows("2:2").Select
Selection.Insert Shift:=xlDown
Range("A1:A2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("C1:C2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("D1:D2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("F1:F2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("G1:G2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("H1:H2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("I1:I2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("J1:J2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("K1:K2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("L1:L2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("M1:M2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("N1:N2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Columns("A:A").Select
Selection.ColumnWidth = 7.57
Columns("B:B").Select
Selection.ColumnWidth = 35.29
Columns("C:C").Select
Selection.ColumnWidth = 12.14
Columns("D:D").Select
Selection.ColumnWidth = 6.71
Columns("E:E").Select
Selection.ColumnWidth = 10.43
Columns("F:F").Select
Selection.ColumnWidth = 14
Columns("G:G").Select
Selection.ColumnWidth = 11.43
Columns("H:H").Select
Selection.ColumnWidth = 12.71
Columns("I:I").Select
Selection.ColumnWidth = 11.71
Columns("J:J").Select
Selection.ColumnWidth = 12
Columns("K:K").Select
Selection.ColumnWidth = 15
Columns("L:L").Select
Selection.ColumnWidth = 17.57
Columns("M:M").Select
Selection.ColumnWidth = 13.14
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
Columns("N:N").Select
Selection.ColumnWidth = 11.86
Columns("N:N").Select
With Selection.Interior
.ColorIndex = 36
.Pattern = xlSolid
End With
Columns("L:L").Select
With Selection.Interior
.ColorIndex = 34
.Pattern = xlSolid
End With
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaper11x17
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With

End Sub


This was made using the "Record New Macro" option from the tools menu. An
example that I have would include something like the following. Cell A13
=
1, Cell 14 = 1.1, Cell 15 = 2, Cell 16 = 2.1. In this case, I want to
make
rows 13 and 15 bold. I need to search for whole numbers as the data
varies
from one job to the next.

Thanks again.
"Don Guillett" wrote:


As ALWAYS, post YOUR code for comments and suggestions. Also, please tell
us
your definition of a whole number. Examples

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike" wrote in message
...
I'm an amateur excel user and I've just taught myself how to create a
macro.
I have a bid program that I export a summary sheet to excel. I've set
up
a
macro to format column widths and column colors. I want to add to this
macro
to search column A for WHOLE numbers. If the cell in column A is a
whole
number, then I want to change that row to bold. Help please?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Search column...change row to BOLD

Please forgive my ignorance! I REALLY appreciate your time and help more
than you know! I'm using merge as there is data in row 1 that won't fit in
the cell when I narrow the column width. For example, the text "Owned
Equipment Total Cost" (actually my column L in these examples) won't fit with
a column width of 17.57. So I merge the cell and wrap the text. Anyway,
onto the topic at hand....

I've made the changes you recommended and it DOES run a lot smoother!
However, now I'm having trouble with the boldintgers part. I get a "Run time
error '13':". Go to debug and "If Len(Application.Trim(mv)) 0" is
highlighted yellow along with "And mv=Int(mv) Then" with an arrow to the
second line. Suggestions?

Mike


"Don Guillett" wrote:

I took the time to clean up your recorded macro to remove selections, etc
Use this to bold your integer rows. To incorporate into the other use

boldintgers
as the last line before end sub in the merge_cells macro

Sub boldintegers()
mc = 1 'col A
For i = 1 To Cells(Rows.Count, mc).End(xlUp).Row
mv = Cells(i, mc)
If Len(Application.Trim(mv)) 0 _
And mv = Int(mv) Then
'MsgBox i
Rows(i).Font.Bold = True
End If
Next
End Sub

Sub Merge_Cells()
'I REALLY do NOT recommend MERGING CELLS. Use center across
Columns("C:D").Delete
Rows("2:2").Insert Shift:=xlDown
With Range("A1:A2,c1:d2,f1:m2")
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Columns("A").ColumnWidth = 7.57
Columns("B").ColumnWidth = 35.29
Columns("C").ColumnWidth = 12.14
Columns("D").ColumnWidth = 6.71
Columns("E").ColumnWidth = 10.43
Columns("F").ColumnWidth = 14
Columns("G").ColumnWidth = 11.43
Columns("H").ColumnWidth = 12.71
Columns("I").ColumnWidth = 11.71
Columns("J").ColumnWidth = 12
Columns("K").ColumnWidth = 15
Columns("L").ColumnWidth = 17.57
Columns("M").ColumnWidth = 13.14
Columns("N").ColumnWidth = 11.86
Columns("N").Interior.ColorIndex = 36
Columns("L").Interior.ColorIndex = 34

'REALLY slows things down so
'comment out or delete changes not necessary
'or UN comment what I commented
With ActiveSheet.PageSetup
'.PrintTitleRows = ""
'.PrintTitleColumns = ""
'.PrintArea = ""

'.LeftHeader = ""
'.CenterHeader = ""
'.RightHeader = ""
'.LeftFooter = ""
'.CenterFooter = ""
'.RightFooter = ""
'.LeftMargin = Application.InchesToPoints(0.75)
'.RightMargin = Application.InchesToPoints(0.75)
'.TopMargin = Application.InchesToPoints(1)
'.BottomMargin = Application.InchesToPoints(1)
'.HeaderMargin = Application.InchesToPoints(0.5)
'.FooterMargin = Application.InchesToPoints(0.5)
'.PrintHeadings = False
'.PrintGridlines = False
'.PrintComments = xlPrintNoComments
'.PrintQuality = 600
'.CenterHorizontally = False
'.CenterVertically = False

.Orientation = xlLandscape

'.Draft = False
.PaperSize = xlPaper11x17

'.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver

'.BlackAndWhite = False
'.Zoom = 100
'.PrintErrors = xlPrintErrorsDisplayed
End With
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike" wrote in message
...
Don, Here's the macro I have set up so far.
Sub Merge_Cells()
'
' Merge_Cells Macro
' Merge Cells for Cost Summary
'

'
Columns("C:D").Select
Selection.Delete Shift:=xlToLeft
Rows("2:2").Select
Selection.Insert Shift:=xlDown
Range("A1:A2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("C1:C2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("D1:D2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("F1:F2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("G1:G2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("H1:H2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("I1:I2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("J1:J2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("K1:K2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("L1:L2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("M1:M2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("N1:N2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Columns("A:A").Select
Selection.ColumnWidth = 7.57
Columns("B:B").Select
Selection.ColumnWidth = 35.29
Columns("C:C").Select
Selection.ColumnWidth = 12.14
Columns("D:D").Select
Selection.ColumnWidth = 6.71
Columns("E:E").Select
Selection.ColumnWidth = 10.43
Columns("F:F").Select
Selection.ColumnWidth = 14
Columns("G:G").Select
Selection.ColumnWidth = 11.43
Columns("H:H").Select
Selection.ColumnWidth = 12.71
Columns("I:I").Select
Selection.ColumnWidth = 11.71
Columns("J:J").Select
Selection.ColumnWidth = 12
Columns("K:K").Select
Selection.ColumnWidth = 15
Columns("L:L").Select
Selection.ColumnWidth = 17.57
Columns("M:M").Select
Selection.ColumnWidth = 13.14
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
Columns("N:N").Select
Selection.ColumnWidth = 11.86
Columns("N:N").Select
With Selection.Interior
.ColorIndex = 36
.Pattern = xlSolid
End With
Columns("L:L").Select
With Selection.Interior

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Search column...change row to BOLD

I did test.

If desired, send your file to my address below along with this msg and
a clear explanation of what you want and before/after examples.
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike" wrote in message
...
Please forgive my ignorance! I REALLY appreciate your time and help more
than you know! I'm using merge as there is data in row 1 that won't fit
in
the cell when I narrow the column width. For example, the text "Owned
Equipment Total Cost" (actually my column L in these examples) won't fit
with
a column width of 17.57. So I merge the cell and wrap the text. Anyway,
onto the topic at hand....

I've made the changes you recommended and it DOES run a lot smoother!
However, now I'm having trouble with the boldintgers part. I get a "Run
time
error '13':". Go to debug and "If Len(Application.Trim(mv)) 0" is
highlighted yellow along with "And mv=Int(mv) Then" with an arrow to the
second line. Suggestions?

Mike


"Don Guillett" wrote:

I took the time to clean up your recorded macro to remove selections, etc
Use this to bold your integer rows. To incorporate into the other use

boldintgers
as the last line before end sub in the merge_cells macro

Sub boldintegers()
mc = 1 'col A
For i = 1 To Cells(Rows.Count, mc).End(xlUp).Row
mv = Cells(i, mc)
If Len(Application.Trim(mv)) 0 _
And mv = Int(mv) Then
'MsgBox i
Rows(i).Font.Bold = True
End If
Next
End Sub

Sub Merge_Cells()
'I REALLY do NOT recommend MERGING CELLS. Use center across
Columns("C:D").Delete
Rows("2:2").Insert Shift:=xlDown
With Range("A1:A2,c1:d2,f1:m2")
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Columns("A").ColumnWidth = 7.57
Columns("B").ColumnWidth = 35.29
Columns("C").ColumnWidth = 12.14
Columns("D").ColumnWidth = 6.71
Columns("E").ColumnWidth = 10.43
Columns("F").ColumnWidth = 14
Columns("G").ColumnWidth = 11.43
Columns("H").ColumnWidth = 12.71
Columns("I").ColumnWidth = 11.71
Columns("J").ColumnWidth = 12
Columns("K").ColumnWidth = 15
Columns("L").ColumnWidth = 17.57
Columns("M").ColumnWidth = 13.14
Columns("N").ColumnWidth = 11.86
Columns("N").Interior.ColorIndex = 36
Columns("L").Interior.ColorIndex = 34

'REALLY slows things down so
'comment out or delete changes not necessary
'or UN comment what I commented
With ActiveSheet.PageSetup
'.PrintTitleRows = ""
'.PrintTitleColumns = ""
'.PrintArea = ""

'.LeftHeader = ""
'.CenterHeader = ""
'.RightHeader = ""
'.LeftFooter = ""
'.CenterFooter = ""
'.RightFooter = ""
'.LeftMargin = Application.InchesToPoints(0.75)
'.RightMargin = Application.InchesToPoints(0.75)
'.TopMargin = Application.InchesToPoints(1)
'.BottomMargin = Application.InchesToPoints(1)
'.HeaderMargin = Application.InchesToPoints(0.5)
'.FooterMargin = Application.InchesToPoints(0.5)
'.PrintHeadings = False
'.PrintGridlines = False
'.PrintComments = xlPrintNoComments
'.PrintQuality = 600
'.CenterHorizontally = False
'.CenterVertically = False

.Orientation = xlLandscape

'.Draft = False
.PaperSize = xlPaper11x17

'.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver

'.BlackAndWhite = False
'.Zoom = 100
'.PrintErrors = xlPrintErrorsDisplayed
End With
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike" wrote in message
...
Don, Here's the macro I have set up so far.
Sub Merge_Cells()
'
' Merge_Cells Macro
' Merge Cells for Cost Summary
'

'
Columns("C:D").Select
Selection.Delete Shift:=xlToLeft
Rows("2:2").Select
Selection.Insert Shift:=xlDown
Range("A1:A2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("C1:C2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("D1:D2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("F1:F2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("G1:G2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("H1:H2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("I1:I2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("J1:J2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("K1:K2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("L1:L2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("M1:M2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("N1:N2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Columns("A:A").Select
Selection.ColumnWidth = 7.57
Columns("B:B").Select
Selection.ColumnWidth = 35.29
Columns("C:C").Select
Selection.ColumnWidth = 12.14
Columns("D:D").Select
Selection.ColumnWidth = 6.71
Columns("E:E").Select
Selection.ColumnWidth = 10.43
Columns("F:F").Select
Selection.ColumnWidth = 14
Columns("G:G").Select
Selection.ColumnWidth = 11.43
Columns("H:H").Select
Selection.ColumnWidth = 12.71
Columns("I:I").Select
Selection.ColumnWidth = 11.71
Columns("J:J").Select
Selection.ColumnWidth = 12
Columns("K:K").Select
Selection.ColumnWidth = 15
Columns("L:L").Select
Selection.ColumnWidth = 17.57
Columns("M:M").Select
Selection.ColumnWidth = 13.14
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
Columns("N:N").Select
Selection.ColumnWidth = 11.86
Columns("N:N").Select
With Selection.Interior
.ColorIndex = 36
.Pattern = xlSolid
End With
Columns("L:L").Select
With Selection.Interior


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Search column...change row to BOLD

Doug,

This is what I've been doing so far. But I could have 100 lines (depending
on the size of the particular project) and each line would have a varying
number of "subordinates". So I'm trying to set up a macro to search for the
integer numbers (1,2,3,...) and make that ROW bold. So I have for example a
pay item "8" Sewer Pipe" in Cell B15 (Cell A15 would be "1"). Cell A16 would
be 1.1 for "Buy materials". Cell B17 would be "Buy backfill material" (Cell
A17 would be 2.1). Cell A18 would be 2.1.1 for "Buy" in Cell B18 and Cell
A19 would be 2.1.2 for "Haul" in Cell B19. This data varies from one job to
the next. In this case, I want to highlight Row 15.

"Doug Glancy" wrote:

Mike,

It sounds like you could use conditional formatting. First highlight the
rows in question. Then in FormatConditional Formatting, choose "Formula
Is". Assuming the first row is 2 and that A2 is the active cell, you'd
enter this in the formula box:

=$A2=Int($A2)

Then click "Format" and choose Bold in the font section.

hth,

Doug

"Mike" wrote in message
...
I'm an amateur excel user and I've just taught myself how to create a
macro.
I have a bid program that I export a summary sheet to excel. I've set up
a
macro to format column widths and column colors. I want to add to this
macro
to search column A for WHOLE numbers. If the cell in column A is a whole
number, then I want to change that row to bold. Help please?

__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4168 (20090618) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




__________ Information from ESET NOD32 Antivirus, version of virus signature database 4168 (20090618) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Search column...change row to BOLD

Mike,

The example I gave you will bold the entire ROW. I assumed that you were
always looking only at column A, which I still think is what you are saying,
but am not entirely sure. If it is multiple columns, it could still be
done.

hth,

Doug

"Mike" wrote in message
...
Doug,

This is what I've been doing so far. But I could have 100 lines
(depending
on the size of the particular project) and each line would have a varying
number of "subordinates". So I'm trying to set up a macro to search for
the
integer numbers (1,2,3,...) and make that ROW bold. So I have for example
a
pay item "8" Sewer Pipe" in Cell B15 (Cell A15 would be "1"). Cell A16
would
be 1.1 for "Buy materials". Cell B17 would be "Buy backfill material"
(Cell
A17 would be 2.1). Cell A18 would be 2.1.1 for "Buy" in Cell B18 and Cell
A19 would be 2.1.2 for "Haul" in Cell B19. This data varies from one job
to
the next. In this case, I want to highlight Row 15.

"Doug Glancy" wrote:

Mike,

It sounds like you could use conditional formatting. First highlight the
rows in question. Then in FormatConditional Formatting, choose
"Formula
Is". Assuming the first row is 2 and that A2 is the active cell, you'd
enter this in the formula box:

=$A2=Int($A2)

Then click "Format" and choose Bold in the font section.

hth,

Doug

"Mike" wrote in message
...
I'm an amateur excel user and I've just taught myself how to create a
macro.
I have a bid program that I export a summary sheet to excel. I've set
up
a
macro to format column widths and column colors. I want to add to this
macro
to search column A for WHOLE numbers. If the cell in column A is a
whole
number, then I want to change that row to bold. Help please?

__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4168 (20090618) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4168 (20090618) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com





__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4168 (20090618) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




__________ Information from ESET NOD32 Antivirus, version of virus signature database 4168 (20090618) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Search column...change row to BOLD


Don,
I found the problem. Your code works just fine. Here's the problem I'm
running into now. Column A may contain what EXCEL recognizes as something
other than a number. For example, it recognizes 2.1 as a number and the
counter works. When it comes across 2.1.1, the error occurs. I sent you a
file to your email. Not sure if you got it. I'm still working on it and
zeroing in on what I need! Thanks again for your help.

Mike

"Don Guillett" wrote:

I did test.

If desired, send your file to my address below along with this msg and
a clear explanation of what you want and before/after examples.
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike" wrote in message
...
Please forgive my ignorance! I REALLY appreciate your time and help more
than you know! I'm using merge as there is data in row 1 that won't fit
in
the cell when I narrow the column width. For example, the text "Owned
Equipment Total Cost" (actually my column L in these examples) won't fit
with
a column width of 17.57. So I merge the cell and wrap the text. Anyway,
onto the topic at hand....

I've made the changes you recommended and it DOES run a lot smoother!
However, now I'm having trouble with the boldintgers part. I get a "Run
time
error '13':". Go to debug and "If Len(Application.Trim(mv)) 0" is
highlighted yellow along with "And mv=Int(mv) Then" with an arrow to the
second line. Suggestions?

Mike


"Don Guillett" wrote:

I took the time to clean up your recorded macro to remove selections, etc
Use this to bold your integer rows. To incorporate into the other use

boldintgers
as the last line before end sub in the merge_cells macro

Sub boldintegers()
mc = 1 'col A
For i = 1 To Cells(Rows.Count, mc).End(xlUp).Row
mv = Cells(i, mc)
If Len(Application.Trim(mv)) 0 _
And mv = Int(mv) Then
'MsgBox i
Rows(i).Font.Bold = True
End If
Next
End Sub

Sub Merge_Cells()
'I REALLY do NOT recommend MERGING CELLS. Use center across
Columns("C:D").Delete
Rows("2:2").Insert Shift:=xlDown
With Range("A1:A2,c1:d2,f1:m2")
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Columns("A").ColumnWidth = 7.57
Columns("B").ColumnWidth = 35.29
Columns("C").ColumnWidth = 12.14
Columns("D").ColumnWidth = 6.71
Columns("E").ColumnWidth = 10.43
Columns("F").ColumnWidth = 14
Columns("G").ColumnWidth = 11.43
Columns("H").ColumnWidth = 12.71
Columns("I").ColumnWidth = 11.71
Columns("J").ColumnWidth = 12
Columns("K").ColumnWidth = 15
Columns("L").ColumnWidth = 17.57
Columns("M").ColumnWidth = 13.14
Columns("N").ColumnWidth = 11.86
Columns("N").Interior.ColorIndex = 36
Columns("L").Interior.ColorIndex = 34

'REALLY slows things down so
'comment out or delete changes not necessary
'or UN comment what I commented
With ActiveSheet.PageSetup
'.PrintTitleRows = ""
'.PrintTitleColumns = ""
'.PrintArea = ""

'.LeftHeader = ""
'.CenterHeader = ""
'.RightHeader = ""
'.LeftFooter = ""
'.CenterFooter = ""
'.RightFooter = ""
'.LeftMargin = Application.InchesToPoints(0.75)
'.RightMargin = Application.InchesToPoints(0.75)
'.TopMargin = Application.InchesToPoints(1)
'.BottomMargin = Application.InchesToPoints(1)
'.HeaderMargin = Application.InchesToPoints(0.5)
'.FooterMargin = Application.InchesToPoints(0.5)
'.PrintHeadings = False
'.PrintGridlines = False
'.PrintComments = xlPrintNoComments
'.PrintQuality = 600
'.CenterHorizontally = False
'.CenterVertically = False

.Orientation = xlLandscape

'.Draft = False
.PaperSize = xlPaper11x17

'.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver

'.BlackAndWhite = False
'.Zoom = 100
'.PrintErrors = xlPrintErrorsDisplayed
End With
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mike" wrote in message
...
Don, Here's the macro I have set up so far.
Sub Merge_Cells()
'
' Merge_Cells Macro
' Merge Cells for Cost Summary
'

'
Columns("C:D").Select
Selection.Delete Shift:=xlToLeft
Rows("2:2").Select
Selection.Insert Shift:=xlDown
Range("A1:A2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("C1:C2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("D1:D2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("F1:F2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("G1:G2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("H1:H2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("I1:I2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("J1:J2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("K1:K2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("L1:L2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("M1:M2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("N1:N2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
ActiveWindow.ScrollColumn = 8
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Columns("A:A").Select
Selection.ColumnWidth = 7.57
Columns("B:B").Select
Selection.ColumnWidth = 35.29
Columns("C:C").Select

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
Search column...change row to BOLD JLGWhiz[_2_] Excel Programming 1 June 19th 09 02:17 AM
Search column...change row to BOLD Doug Glancy Excel Programming 0 June 19th 09 01:54 AM
Search column...change row to BOLD Don Guillett Excel Programming 1 June 19th 09 12:48 AM
Search column...change row to BOLD JLGWhiz[_2_] Excel Programming 0 June 19th 09 12:33 AM
Search and change font color to Red and bold it CAM Excel Programming 1 June 28th 08 08:19 AM


All times are GMT +1. The time now is 05:35 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"