Cell Content

  • Thread starter Thread starter wfgfreedom
  • Start date Start date
W

wfgfreedom

I am trying to use a Macro to sort through a table of numeric values
and modify the values based on a series of If statements. Can someone
tell me if the contents of a cell can be modified with a Macro, other
than simple Copy/Cut/Paste funstion?

Can I include Excel Formula such as (=A1+A6) in a Macro?

Frank.
 
I am trying to use a Macro to sort through a table of numeric values
and modify the values based on a series of If statements.  Can someone
tell me if the contents of a cell can be modified with a Macro, other
than simple Copy/Cut/Paste funstion?

Can I include Excel Formula such as (=A1+A6) in a Macro?

Frank.
hello,
you can modify the value of a cell in a macro by writing a command
similar to:
Range("A1").Value = 123
and you can enter a formula by writing a command similar to:
Range("B1").Formula = "=sum(A1:A6)"
 
On Jan 16, 4:50 pm, (e-mail address removed) wrote:> I am trying to use a Macro to sort through a table of numeric values



hello,
you can modify the value of a cell in a macro by writing a command
similar to:
Range("A1").Value = 123
and you can enter a formula by writing a command similar to:
Range("B1").Formula = "=sum(A1:A6)"

Thanks for your help. I will give it a try.

Frank
 
On Jan 16, 4:50 pm, (e-mail address removed) wrote:> I am trying to use a Macro to sort through a table of numeric values



hello,
you can modify the value of a cell in a macro by writing a command
similar to:
Range("A1").Value = 123
and you can enter a formula by writing a command similar to:
Range("B1").Formula = "=sum(A1:A6)"

I tried the command and it works well. Howver, I also would like to
introduce a variable into the equation as follows:
Range("B1").Formula = "=sum(A1:A6)" + Variable

Is this possible?

Frank
 
On said:
I tried the command and it works well. Howver, I also would like to
introduce a variable into the equation as follows:
Range("B1").Formula = "=sum(A1:A6)" + Variable

Is this possible?

Frank
somthing like this?

Dim i As Variant
i = InputBox("Additional number to add?")
Range("B1").Formula = "=sum(A1:A6," & i & ")"
 
somthing like this?

Dim i As Variant
i = InputBox("Additional number to add?")
Range("B1").Formula = "=sum(A1:A6," & i & ")"- Hide quoted text -

- Show quoted text -

I just tried your suggestion and it does what I was looking for.

Thanks,
Frank
 
Back
Top