LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default If, Else statements

Thanks Bob

at least I don't get the error now.

I need to track the changes in particular cells when running this code. at
the moment I have used the:

" Private Sub Worksheet_Change(ByVal Target As Range)" option but this does
not change the values either when i update the cells.

Any ideas? I appreciate you help.

Regards

Steve R

"Steve" wrote:

Hi

Can anyone please help me? I get an "Else without If" error when running
this and not sure why as it seems the same as the example in the help file.

Also, what is the best way to run it if I want to run this when a certain
cell is changed. Or can it only be done when the worrksheet is changed.

Many thanks

Steve R


If Cells.Cells(9, 3).Value = "" Then Cells.Cells(9, 8).Value = ""

ElseIf Cells.Cells(9, 7).Value = "N/A" Then Cells.Cells(9, 8).Value = "0"

' Category S

ElseIf Cells.Cells(9, 7) = "S" & Cells.Cells(9, 6).Value < 5 Then
Cells.Cells(9, 8).Value = "0"

ElseIf Cells.Cells(9, 7) = "S" & Cells.Cells(9, 6) < 10 Then Cells.Cells(9,
8).Value = "5%"

ElseIf Cells.Cells(9, 7) = "S" & Cells.Cells(9, 6) 9 Then Cells.Cells(9,
8).Value = "10%"

' Category P

ElseIf Cells.Cells(9, 7) = "P" & Cells.Cells(9, 6) < 3 Then Cells.Cells(9,
8).Value = "0"

ElseIf Cells.Cells(9, 7) = "P" & Cells.Cells(9, 6) < 5 Then Cells.Cells(9,
8).Value = "5%"

ElseIf Cells.Cells(9, 7) = "P" & Cells.Cells(9, 6) < 10 Then
Cells.Cells(9, 8).Value = "15%"

ElseIf Cells.Cells(9, 7) = "P" & Cells.Cells(9, 6) 10 Then
Cells.Cells(9, 8).Value = "20%"

Else

Cells.Cells(9, 8).Value = ""

End If
--
Steve R

 
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
If Statements Johnronn Excel Discussion (Misc queries) 1 September 9th 09 09:19 PM
if then statements BC Excel Worksheet Functions 2 April 30th 09 11:37 PM
IF Statements (Mutliple Statements) Deezel Excel Worksheet Functions 3 October 19th 06 06:13 AM
if and or statements Debbie via OfficeKB.com Excel Discussion (Misc queries) 4 June 13th 06 02:24 PM
IF & AND statements hip Excel Worksheet Functions 5 June 7th 06 11:36 PM


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