Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dang, you guys make it look so easy! I now remember about the difference
between these: = "*Total" and Like "*Total" I've used this technique before, but temporarily forgot this time. However, I wasn't going to figure out this one: Range(C.Offset(0, 1), C.Offset(0, 6)).Cells. _ Borders.LineStyle = xlContinuous or this one: c.Offset(, 1).Resize(, 6) _ ..BorderAround , Weight:=xlMedium So thanks for that stuff guys!! Regards, Ryan-- -- RyGuy "Don Guillett" wrote: Sub doborders()' for ONE Columns("J").Find("Total").Offset(, 1).Resize(, 6) _ .BorderAround , Weight:=xlMedium End Sub Sub dobordersmore()' For many With ActiveSheet.Columns("j") Set c = .Find("Total", LookIn:=xlValues) If Not c Is Nothing Then firstAddress = c.Address Do c.Offset(, 1).Resize(, 6) _ .BorderAround , Weight:=xlMedium Set c = .FindNext(c) Loop While Not c Is Nothing And c.Address < firstAddress End If End With End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "ryguy7272" wrote in message ... I found this tiny macro on the web and I was trying to modify it for my purposes, which basically includes finding and selecting cells with the word €˜Total and placing a boarder around cells in that same row, STARTING one column to the right and six columns to the right of that. Sub AddBorders() 'start cell Range("J1:J500").Select Do Until ActiveCell = Empty If Cells = "*Total" Then Selection.Offset(0, 1).Select ActiveCell.Offset(0, 6).Select Selection.Borders(xlEdgeLeft).LineStyle = xlContinuous Selection.Borders(xlEdgeTop).LineStyle = xlContinuous Selection.Borders(xlEdgeBottom).LineStyle = xlContinuous Selection.Borders(xlEdgeRight).LineStyle = xlContinuous End If Loop End Sub Obviously the macro doesnt work (or I wouldnt be posting here). It fails on this line: If Selection = "*Total" Then What am I doing wrong? Regards, Ryan--- -- RyGuy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find text in N columns and one Row | Excel Worksheet Functions | |||
create a macro to delete columns and then border remaining columns | Excel Programming | |||
How to find and highlight common text in multiple columns | Excel Discussion (Misc queries) | |||
Find a suitable border for a religious text | Charts and Charting in Excel | |||
compare two text columns and find the closest matched pair of cells | Excel Programming |