[RESOLVED] Automaticle calculate cell´s depending of another cell´s value
Hello, People i´m not getting it...:sick:
i need to calculate the value o a cell in function of other cell value for example:
if cell("A1").value = 1 then cell("A2").value = cell("A1").value + 1
and also i need to run all cells in that row
can anyone pleazz help?
thankx
Re: Automaticle calculate cell´s depending of another cell´s value
Re: Automaticle calculate cell´s depending of another cell´s value
Change this
cell("A1").value = 1 then cell("A2").value = cell("A1").value + 1
to
Code:
'Change Sheet1 below to the name of the relevant sheet
If Sheets("Sheet1").Range("A1").Value = 1 Then
Sheets("Sheet1").Range("A2").Value = Sheets("Sheet1").Range("A1").Value + 1
End If
Re: Automaticle calculate cell´s depending of another cell´s value
OK :), koolsid it worked fine for what i need :) thanks. now how do i , run it for the following rows ? (witch a cicle i think) I'm on A1 ,and i need to do it till the A300 for example.
Re: Automaticle calculate cell´s depending of another cell´s value
Here is an example
vb Code:
Option Explicit
Sub test()
Dim i As Integer
'Change 300 to the respective row number
For i = 1 To 300
'i will increment each time the for loop is
'executed for 300 times
If Sheets("Sheet1").Range("A" & i).Value = 1 Then
'your code
End If
Next i
End Sub
Re: Automaticle calculate cell´s depending of another cell´s value
Koolsid, it work´s perfectly :)
Thankx man