View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Compile Error: Block If without End if

Range("M2:M999").Formula = "=IF(K2=2,""FedEx Ground"",IF(K2=3,""FedEx
2Day"","""")"

so combining the suggestion with VBA can often be very fast.

--
REgards,
Tom Ogilvy

"Ardus Petus" wrote in message
...
Thanks for your explanations.
This is no VBA job (too slow)
You'd rather enter the following formula into M2 et copy it down to M999:

=IF(K2=2;"FedEx Ground;IF(K2=3,"FedEx 2Day","")

HTH
--
AP

a écrit dans le message de
oups.com...
This is my first time using a Microsoft Excel Macro and I'm trying to
run the following code and keep getting the:

Compile Error: Block If without End if message and I can't figure out
why


Sub P()
'
' Macro1 Macro
' Changing FedEx Descriptions
'
' Keyboard Shortcut: Ctrl+Shift+X
'
If Range("K2:K999").Select = "02" Then


Range("M2:M999").Select = "FedEx Ground"
Else


If Range("K2:K999").Select = "03" Then
Range("M2:M999").Select = "FedEx 2Day"


Else


If Range("K2:K999").Select = "" Then
Range("M2:M999").Select = ""


End If
End Sub