Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
A wonderful programmer provided me with this code and I would like for
it to work only if the row "contains" the text "total". This doesn't work unless the cell specifically says "total". Thanks for your help in advance. Option Explicit Dim MyCell, MyRng As Range Dim i As Integer Private Sub CommandButton1_Click() Set MyRng = [a1:a65000] 'set your range For Each MyCell In MyRng If MyCell.Value = "total" Then MyCell.Offset(1, 0).Select Do While i < 4 ActiveCell.EntireRow.Insert i = i + 1 Loop ActiveCell.Value = "Avails" ActiveCell.EntireRow.Interior.ColorIndex = 5 ActiveCell.Offset(1, 0).Value = "Left" ActiveCell.Offset(1, 0).EntireRow.Interior.ColorIndex = 6 End If Next MyCell End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
Custom Data Validation : Lock if MyCell = ""? | Excel Worksheet Functions | |||
Linking two "total" pages to create a "Complete Total" page | Excel Worksheet Functions | |||
Application.Goto reference:="MyCell" | Excel Programming | |||
Search "Total" in all worksheets and delete rows containing "Total" | Excel Programming |