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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ActiveCell.Formula 1

Status
Not open for further replies.

bobibob

Technical User
Jun 28, 2001
13
SI
Hello
I'm trying to write my first macro for excel in VBA.
I recorded a macro and now I'm trying tu costumize it.

I have problem with ActiveCell.Formula
I'm trying to write a formula in a cell.
When I record a macro I get
ActiveCell.Formula="=Page1!B1" and it works
but I want to define formula which is depended on one number.

I tried this:
Public Type spremenljivke
number1 As Integer
variable1 As String
End Type

Sub Macro1()

......

number1=1
variable1="Page1!B1"+Str(number1)
ActiveCell.Formula=variable1

......

End Sub

But this not working
Can anyone help me?

Bob
 
...
variable1="Page1!B1"+Str(number1)
...

replace with that:

variable1= "= Page1!B1 + " & val(number1)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top