View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Pass Variable to another Sub

Or you could just pass the value to the other sub:

Option Explicit
Sub Wall()
Dim WallE1 as Double 'don't bother with Single
WallE1 = activesheet.range("a1").value
Call NextWall(someval:=WallE1)
End Sub

Sub NextWall(SomeVal as Double)
activesheet.range("a2").value = someval
End sub


CSUS_CE_Student wrote:

Hey everyone, i need some help. I am trying to pass a variable to another
sub. I will need to pass 3-4 variables total, so if my example wont allllow
for this please let me know what i need to do. I did look at other posts
but was not able to find something that worked ( or i didnt know it would).
Im not that knowegable in programing.

Sub Wall()
Dim WallEl As Single
WallEl = Range("a1").Value
End Sub

Sub NextWall()
Range("a2") = WallEl
End Sub

Thanks for your help in advance

jared


--

Dave Peterson