View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default If cell D2 begins with 00 then E2 =

The code would look like the following:

Sub AAA()
Select Case UCase(Left(Range("D2").Text, 2))
Case "00", "11", "CA"
Application.Intersect(ActiveSheet.UsedRange, _
Range("E2").EntireColumn).Value = "INTL"
Range("E2").Value = "DOM"
Case Else
End Select
End Sub

If you want it to run automatically when a cell is changed, use the
Change event instead. In the worksheet's code module, use

Private Sub Worksheet_Change(ByVal Target As Range)
Select Case UCase(Left(Range("D2").Text, 2))
Case "00", "11", "CA"
Application.EnableEvents = False
Application.Intersect(Me.UsedRange, _
Range("E2").EntireColumn).Value = "INTL"
Range("E2").Value = "DOM"
Application.EnableEvents = True
Case Else
End Select
End Sub

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com




On Mon, 22 Feb 2010 11:15:07 -0800, "dizzl3e"
wrote:

I am trying to automate a process on a spreadsheet. Where Cell D2 begins
with "00" or "11" or "CA" then Cell E2="DOM". Once its run its process then
I want it to label everything else on column E "INTL". Any help is greatly
appreciated. thanks.