Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I've recorded a macro but it doesn't run how I want them:
Range("AA2").Select Range(Selection, Selection.End(xlDown)).Select Selection.FormatConditions.Add Type:=xlTextString, String:="Accept", _ TextOperator:=xlContains Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Interior .PatternColorIndex = xlAutomatic .Color = 5287936 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = False Selection.FormatConditions.Add Type:=xlTextString, String:="Reject", _ TextOperator:=xlContains Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Interior .PatternColorIndex = xlAutomatic .Color = 255 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = False Selection.FormatConditions.Add Type:=xlTextString, String:="Consider", _ TextOperator:=xlContains Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Interior .PatternColorIndex = xlAutomatic .Color = 49407 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = False I've tried to change to Range("AA2:AA" & lngRow) but it still doesn't work. Can anyone help? |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Should work if lngRow is settup properly:
Dim lngRow as Long lngRow = 123 Range("AA2:AA" & lngRow).Select -- Gary''s Student - gsnu200904 "Kim" wrote: I've recorded a macro but it doesn't run how I want them: Range("AA2").Select Range(Selection, Selection.End(xlDown)).Select Selection.FormatConditions.Add Type:=xlTextString, String:="Accept", _ TextOperator:=xlContains Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Interior .PatternColorIndex = xlAutomatic .Color = 5287936 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = False Selection.FormatConditions.Add Type:=xlTextString, String:="Reject", _ TextOperator:=xlContains Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Interior .PatternColorIndex = xlAutomatic .Color = 255 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = False Selection.FormatConditions.Add Type:=xlTextString, String:="Consider", _ TextOperator:=xlContains Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Interior .PatternColorIndex = xlAutomatic .Color = 49407 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = False I've tried to change to Range("AA2:AA" & lngRow) but it still doesn't work. Can anyone help? |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have already set it up for other formulas. Every time I tried to run, it
doesnt work. Keep showing "With Selection" part as error. I got previous formulas. Not sure that would help strFormula9 = "=IF(Z2=Accept,""Accept"",IFZ2=Consider,""Consid er""_ ,""Reject""))" Range("AA2:AA" & lngRow).Formula = strFormula9 Regards, Kim "Gary''s Student" wrote: Should work if lngRow is settup properly: Dim lngRow as Long lngRow = 123 Range("AA2:AA" & lngRow).Select -- Gary''s Student - gsnu200904 "Kim" wrote: I've recorded a macro but it doesn't run how I want them: Range("AA2").Select Range(Selection, Selection.End(xlDown)).Select Selection.FormatConditions.Add Type:=xlTextString, String:="Accept", _ TextOperator:=xlContains Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Interior .PatternColorIndex = xlAutomatic .Color = 5287936 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = False Selection.FormatConditions.Add Type:=xlTextString, String:="Reject", _ TextOperator:=xlContains Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Interior .PatternColorIndex = xlAutomatic .Color = 255 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = False Selection.FormatConditions.Add Type:=xlTextString, String:="Consider", _ TextOperator:=xlContains Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Interior .PatternColorIndex = xlAutomatic .Color = 49407 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = False I've tried to change to Range("AA2:AA" & lngRow) but it still doesn't work. Can anyone help? |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Assuming that the list is dynamic, you are adding rows to the data then you
need to find what the lastrow is each time. Adapt this which closely follows your code. Sub LastRowNumber() Dim LastRow As Long Range("AA2").Select Range(Selection, Selection.End(xlDown)).Select LastRow = Selection.Rows.Count + 1 MsgBox LastRow End Sub HTH Peter "Kim" wrote: I've recorded a macro but it doesn't run how I want them: Range("AA2").Select Range(Selection, Selection.End(xlDown)).Select Selection.FormatConditions.Add Type:=xlTextString, String:="Accept", _ TextOperator:=xlContains Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Interior .PatternColorIndex = xlAutomatic .Color = 5287936 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = False Selection.FormatConditions.Add Type:=xlTextString, String:="Reject", _ TextOperator:=xlContains Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Interior .PatternColorIndex = xlAutomatic .Color = 255 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = False Selection.FormatConditions.Add Type:=xlTextString, String:="Consider", _ TextOperator:=xlContains Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Interior .PatternColorIndex = xlAutomatic .Color = 49407 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = False I've tried to change to Range("AA2:AA" & lngRow) but it still doesn't work. Can anyone help? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
My excel macro recorder no longer shows up when recording macro | Excel Discussion (Misc queries) | |||
using a cell value to control a counter inside a macro and displaying macro value | Excel Worksheet Functions | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) |