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: 290
Default cell formatting

Hi guys,

I am having troubles with some code that I am adapting, I want it to
make the entire row red on the found cell but it keeps bugging out, I
am not sure what I have done wrong here! any ideas?...(ill paste the
full sub below)

Private Sub LiveSubmit_Click()
Dim si As New SystemInfo
Dim retval As Variant
Dim wks As Worksheet
Dim FoundCell As Range
Dim myCell As Range
Dim ActSheet As Worksheet
Dim resp As Long

If Len(LiveBcNo.Value) 13 Then
LiveBcNo.Value = Mid(LiveBcNo.Value, 2, 13)
End If

If LiveBcNo.Value <= "" Then
If LiveYear <= "" Then
MsgBox "Must Fill in Levy Year", vbOKOnly
Exit Sub
Else
If LiveRegNo <= "" Then
MsgBox "Must Fill in Registration number", vbOKOnly
Exit Sub
Else
LiveBcNo.Value = LiveYear & "000" & LiveRegNo & "11"
End If
End If
End If

Set ActSheet = ActiveSheet

If IsNumeric(LiveBcNo.Value) = False Then Exit Sub
If Trim(LiveBcNo.Value) = "" Then Exit Sub

resp = MsgBox(prompt:="Are you sure you want to clean up: " _
& LiveBcNo.Value & "?", Buttons:=vbYesNo)

If resp = vbNo Then
Exit Sub
End If

For Each wks In ActSheet.Parent.Worksheets
If wks.Name < ActSheet.Name Then
'do nothing
Else
Do
With wks.Range("a:a")
Set FoundCell = .Find(What:=LiveBcNo.Value, _
after:=.Cells(.Cells.Count), _
LookIn:=xlValues, LookAt:=xlWhole,
_
SearchOrder:=xlByRows, _
SearchDirection:=xlNext)
End With

If FoundCell Is Nothing Then
'done with that worksheet
Exit Do
Else

FoundCell.EntireRow.Select

With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With


End If
Loop
End If
Next wks

LiveBcNo.Value = ""
LiveRegNo.Value = ""
LiveBcNo.SetFocus
End Sub

 
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
Conditional formatting--different formatting depending on cell con Tammy S. Excel Discussion (Misc queries) 3 March 30th 09 08:11 PM
Protect Cell Formatting including Conditional Formatting Mick Jennings Excel Discussion (Misc queries) 5 November 13th 07 05:32 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 3 January 20th 07 02:02 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 0 January 15th 07 04:35 PM
expanding custom formatting without removing existing cell formatting? Keith Excel Worksheet Functions 3 December 27th 06 01:54 PM


All times are GMT +1. The time now is 11:50 PM.

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"