Select your workbook's project in the VBE.
Then click on Insert (on the menu bar), then Module (plain old module).
Check he
http://www.contextures.com/xlVideos04.html#CopyCode
http://www.contextures.com/xlvba01.html#Regular
Move (not copy!) the declarations into that module.
Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html
David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm
(General, Regular and Standard modules all describe the same thing.)
Madduck wrote:
Hi Dave,
thanks for your help on this....
yes this is the definitions so far..
Option Explicit
Public strName As String
Public strLogic As String
Public IntNameset As Long
Public strPaste As String
Public Gemvalue As Long
Public Raidnumber As String
Public GemRowloc As Long
Public GemColloc As Long
I am sorry for being a noob, but when you say a General module... I'm not
sure what you mean, if they don't go behind any of the sheets or the
workbook, how does one set up a general module? that will follow the file if
I was to send it home etc...
"Dave Peterson" wrote:
How/where did you declare the GemValue variable?
Did you put it in that same general module along with GemRowLoc and GemColLoc?
Option Explicit
Public GemRowLoc As Long
Public GemColLoc As Long
Dim GemValue As Long
Madduck wrote:
Thanks Guys,
I have changed the varible names as suggested...
This script is far from complete, as I'm learning as I go....
as such I have a few "test outputs"
from the form "Gemlist" I can output Gemname to a cell.
What I can't seem to do is pass the value back to the main code...
I did not want to paste the whole code , and clog up the forums, but here is
the entire code behind the form "gemlist"
Sub SubmitButton1_Click()
Sheets("Rift_raid").Select
Gemid
Cells(GemRowloc, GemColloc).Value = Gemname.Value
Range("o1") = ""
Gemname.Value = ""
Gemname.Clear
Gemlist.Hide
End Sub
Sub Gemid()
If Gemname.Value = "Boots" Then
Gemvalue = 1
ElseIf Gemname.Value = "Gloves" Then
Gemvalue = 2
ElseIf Gemname.Value = "Leggings" Then
Gemvalue = 3
ElseIf Gemname.Value = "Chest" Then
Gemvalue = 4
ElseIf Gemname.Value = "Helm" Then
Gemvalue = 5
Else
Gemvalue = 6
End If
Range("o1") = Gemvalue ' for transporting the value out of the subroutine
End Sub
Private Sub userform_Activate()
Gemname.AddItem ("Boots")
Gemname.AddItem ("Gloves")
Gemname.AddItem ("Leggins")
Gemname.AddItem ("Chest")
Gemname.AddItem ("Helm")
Gemname.AddItem ("Shoulders")
Gemname.AddItem ("Weapon")
End Sub
--
Dave Peterson
--
Dave Peterson