LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Find Text, Add Border 6 Columns to Right

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
 
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
Find text in N columns and one Row Carpe Diem Excel Worksheet Functions 1 November 30th 11 01:02 PM
create a macro to delete columns and then border remaining columns Jane777 Excel Programming 1 July 18th 07 12:08 AM
How to find and highlight common text in multiple columns ToExcelAtExcel Excel Discussion (Misc queries) 2 November 13th 06 10:44 PM
Find a suitable border for a religious text Allan Charts and Charting in Excel 0 September 25th 06 12:24 AM
compare two text columns and find the closest matched pair of cells betty77 Excel Programming 1 August 4th 06 03:56 PM


All times are GMT +1. The time now is 02:09 AM.

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"