Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default With active cell

hi i am extremely new to vba and need some help. I have recorded a macro where i perform a search within a selected range. the code ends ".activate" when it has found the specified text. now i want to apply some formatting to the cells in that row. I am happy to use the offset function (unless there is an easier way) but how do i make it so it is applied to the active cell so i can continue with "selection." i suppose i want to make it a relative reference not "Range("A13:E13").Select
does that make sense to anyone

I would appreciate any help as i am an extreme novice who is losing confidence fast
thank
kevin
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default With active cell

'Didn't know if you needed the first line relative or just the stuff below


Range("B4:B18").Select
Selection.Find(What:="Mr Smith", After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False).Activate
With Range(Cells(ActiveCell.Row, 1), Cells(ActiveCell.Row, 5))
.Borders(xlEdgeTop).LineStyle = xlContinuous
.Borders(xlEdgeTop).Weight = xlThin
.Borders(xlEdgeTop).ColorIndex = xlAutomatic
.Borders(xlEdgeBottom).LineStyle = xlContinuous
.Borders(xlEdgeBottom).Weight = xlThin
.Borders(xlEdgeBottom).ColorIndex = xlAutomatic
.Font.Bold = True
End With




"kevin" wrote in message ...
Hope this makes it a little clearer.

Range("B4:B18").Select
Selection.Find(What:="Mr Smith", After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False).Activate
'make relative
'Active cell.Select
'Range("A13:E13").Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Font.Bold = True
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default With active cell

Kevin,

Is this what you want?

Range("B4:B18").Find(What:="Mr Smith", _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False).Activate
'make relative
'Active cell.Select
'Range("A13:E13").Select
With Selection.EntireRow
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
.Font.Bold = True
End With


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"kevin" wrote in message
...
Hope this makes it a little clearer.

Range("B4:B18").Select
Selection.Find(What:="Mr Smith", After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,

SearchDirection:= _
xlNext, MatchCase:=False).Activate
'make relative
'Active cell.Select
'Range("A13:E13").Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Font.Bold = True



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default With active cell

If I understood you correctly, you wanted to find Mr. Smith and format a
ANOTHER cell based on that location.

Sub FormatOffset()
Range(Columns("b").Find("Mr Smith").address).Offset(1, 2).Select
myBorders = Array(, xlEdgeLeft, xlEdgeTop, xlEdgeBottom, xlEdgeRight)
For i = 1 To UBound(myBorders)
With Selection.Borders(myBorders(i))
.LineStyle = xlContinuous
.Weight = xlMedium
End With
Next
Selection.Font.Bold = True
End Sub

to do range("a foundrow:e foundrow"), use this

Sub Formatfoundrow()
x = Columns("b").Find("Mr Smith").Row
MsgBox x
Range(Cells(x, 1), Cells(x, 5)).Select
myBorders = Array(, xlEdgeLeft, xlEdgeTop, xlEdgeBottom, xlEdgeRight)
For i = 1 To UBound(myBorders)
With Selection.Borders(myBorders(i))
.LineStyle = xlContinuous
.Weight = xlMedium
End With
Next
Selection.Font.Bold = True
End Sub



--
Don Guillett
SalesAid Software

"kevin" wrote in message
...
Hope this makes it a little clearer.

Range("B4:B18").Select
Selection.Find(What:="Mr Smith", After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,

SearchDirection:= _
xlNext, MatchCase:=False).Activate
'make relative
'Active cell.Select
'Range("A13:E13").Select
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Font.Bold = True



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
Row select mode to highlight active row of active cell Bart Fay[_2_] Excel Discussion (Misc queries) 0 May 11th 10 09:34 PM
set the background color of the current cell(active cell) kang New Users to Excel 2 July 31st 07 04:48 PM
referring to formula in a non active cell from active cell nickname Excel Discussion (Misc queries) 1 June 21st 07 12:11 PM
HOW TO COPY 480 ACTIVE E-MAIL ADDRESSES CLM "G" ON AN ACTIVE EXCE. ragman10 Excel Discussion (Misc queries) 1 December 13th 04 11:52 PM
Active cell plus 1 Tim Excel Programming 2 February 24th 04 06:26 PM


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