Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can not get cell in Excel to update automatically

Status
Not open for further replies.

structural01

Structural
Joined
Jul 15, 2004
Messages
51
Location
US
Hi,
I am fairly new to VB.

I could not get the cell "c11" in Excel to update automatically once a number is entered in cell "c10".

I wrote the following in VB ...
if c10<=10 then
x=1.0
range"c11".value=x
end if

if c10>10 then
x=2.5
range"c11".value=x
end if


Thanks in advance for any help.



 
You need to reference the cell as a range each time.
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("c10").Value <= 10 Then
x = 1
Else
x = 2.5
End If
Range("c11") = x
End Sub

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting

Steam Engine enthusiasts:
 
Johnwm,
Thanks for your respond.

I wrote this statement...

Range("E285").Value = 1.1766 - 1.1766 * Log(d285)

But, I am getting a error. It does not recognize cell d285. Am I doing something wrong?

Thanks again.

 
As I said, you need to reference the cell as a range each and every time.

Range("E285").Value = 1.1766 - 1.1766 * Log(RANGE("d285").Value)

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting

Steam Engine enthusiasts:
 
I am not a computer person. So, the computer terminolgy is not understood.

Now I understand. I tried it and it works. Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top