Dr.Evil925
New Member
- Joined
- Feb 24, 2011
- Messages
- 22
I have a range in vba defined as "FoundCell" it consists of a single cell, lets say J1. How can I resize it? I need it to be J1:J20.
Help!
Code:
Dim FoundCell As Range
Dim FoundName As Range
Application.ScreenUpdating = False
With Worksheets("Account DB")
With .Rows(1)
Set FoundCell = .Find(what:=cbCust.Value, LookIn:=xlValues, lookat:=xlWhole, MatchCase:=faulse)
With FoundCell.EntireColumn
Set FoundName = .Find(what:=cbName.Value, LookIn:=xlValues, lookat:=xlWhole, MatchCase:=faulse)
If FoundName Is Nothing Then
If Not IsEmpty(FoundCell.Offset(1)) Then
FoundCell.End(xlDown).Offset(1).Value = cbName.Value
Else
FoundCell.Offset(1).Value = cbName.Value
End If
MsgBox "Added " & cbName.Value & "!"
FoundCell.resize(20, 0).Select
Else
MsgBox cbName.Value & " already exists"
End If
End With
End With
End With