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: 20
Default Block If

I'm trying to create a really long =if command in Excel VBA editor but I keep
getting multiple errors, the latest is a "End if with no block If" error.
But I know I'm setting up the character values incorrectly also! Please
Help!!!

Sub Usage()

Dim Usage As Double
Dim J As Double
Dim K As Double
Dim L As Double
Dim M As Double
Dim N As Double
Dim O As Double
Dim P As Double
Dim Q As Double
Dim R As Double
Dim S As Double
Dim T As Double
Dim U As Double
Dim W As Double

K = Cell.K2
L = Cell.L2
M = Cell.M2
N = Cell.N2
O = Cell.O2
P = Cell.P2
Q = Cell.Q2
R = Cell.R2
S = Cell.S2
T = Cell.T2
U = Cell.U2
W = Cell.W2


Usage = (K + M + O + Q + S + U) / 6

If Usage 20 Then Cell.AA2 = (W / 15) Else:

If (J / K) (L / M) And (J / K) (N / O) And (J / K) (P / Q) And (J / K)
(R / S) And (J / K) (T / U) Then Cell.AA2 = (J / K) Else:

If (L / M) (J / K) And (L / M) (N / O) And (L / M) (P / Q) And (L / M)
(R / S) And (L / M) (T / U) Then Cell.AA2 = (L / M) Else:

If (N / O) (L / M) And (N / O) (J / K) And (N / O) (P / Q) And (N / O)
(R / S) And (N / O) (T / U) Then Cell.AA2 = (N / O) Else:

If (P / Q) (L / M) And (P / Q) (N / O) And (P / Q) (J / K) And (P / Q)
(R / S) And (P / Q) (T / U) Then Cell.AA2 = (J / K) Else:

If (R / S) (L / M) And (R / S) (N / O) And (R / S) (P / Q) And (R / S)
(J / K) And (R / S) (T / U) Then Cell.AA2 = (R / S) Else:

If (T / U) (L / M) And (T / U) (N / O) And (T / U) (P / Q) And (T / U)
(R / S) And (T / U) (J / K) Then Cell.AA2 = (T / U)

End If
End If
End If
End If
End If
End If
End If


Selection.AutoFill Destination:=Range("AA2:AA3943"), Type:=xlFillDefault
Range("AA2:AA3943").Select

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
End if without Block If Carrie_Loos via OfficeKB.com Excel Worksheet Functions 7 May 14th 08 06:47 PM
mental block Lost in excel Excel Worksheet Functions 3 January 14th 07 08:18 PM
Mental block Jack Sheet New Users to Excel 3 March 22nd 06 08:31 PM
How do I subtract block N19 from L19. Eddy J Excel Worksheet Functions 2 October 21st 05 11:33 PM
block scrolling Claude Excel Programming 1 July 15th 04 03:19 AM


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