|
-
May 20th, 2003, 11:51 AM
#1
Thread Starter
New Member
if statement
I am new to this and would appreciate some help.
Say range c30 on sheet 1 value = 10
range b1 on sheet 1 value = 10
range c45 on sheet 1 value = 10000
I am trying to write the following statement
if Sheets("sheet1").range("c30").value = Sheets("sheet1").range("c30").value then
sheets("data").range("b9").value = sheets("sheet1").range("c45").value
else sheets("data").range("b9").value = 0
end if
It is not working. please help
-
May 22nd, 2003, 08:35 PM
#2
Frenzied Member
Ok, looks like you might be reffering to the cells wrong and the Else you have should be ElseIf...
VB Code:
If Sheet1.Range("$C$30").Value = Sheet1.Range("$C$30").Value Then
Sheet2.Range("$B$9").Value = Sheet1.Range("$C4$5").Value
Else
Sheet2.Range("$B$9").Value = 0
End If
Though the purpose of this is beyond me, you are checking to see if the value of cell C-30 is its self, which will always be true so it will always copy its self to B-9 on whatever page.
-
May 23rd, 2003, 02:29 AM
#3
Fanatic Member
Not sure what you are trying to do. Maybe this:
VB Code:
If Sheets("Sheet1").Range("C30").Value = Sheets("Sheet1").Range("B1").Value Then
Sheets("Data").Range("B9").Value = Sheets("Sheet1").Range("C45").Value
Else
Sheets("Data").Range("B9").Value = 0
End If
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|