Sorry I didn't get back to you earlier.. I had to scrap this approach
as it wasn't going to work in the long run.  Requirements changed,
actually, it's a bit of scope creep, but c'est la vie.

On Oct 11, 10:47 am, Paul Schreiner <schreiner_p...@att.net> wrote:
> How are you calling thefunction?
>
> I copied yourfunctionto a module.
> I changed it to:FunctionDeviceForm(rng As Range) As String
>     If UCase(rng.Value) = "X" Then
>         MsgBox "Row: " & rng.Row
>     End If
> EndFunction
>
> so that I didn't have to create auserform.
>
> then put a "X" in A2.
> in B2 I put:
> =deviceform(A2)
>
> them menu then popped up with the row # (2).
> I moved the X to A4, and the popup displayed (4)..
>
> is the rng.Row what you were looking for?
>
> Paul
>
>
>
> ----- Original Message ----
> > From: RemyMaza <remym...@gmail.com>
> > To: MS EXCEL AND VBA MACROS <excel-macros@googlegroups.com>
> > Sent: Mon, October 11, 2010 9:49:14 AM
> > Subject: $$Excel-Macros$$CustomFunctionwithUserForm
>
> > I have a simplefunctionthat looks at a single cell for it's value.
> > If it's an X, then i'd like for a form to appear.  I'd like to pass
> > the value rng.row to the form so I can know which row I'm
> > manipulating.  I've failed so far in my attempts to do just that.  Any
> > tips would be awesome.
>
> >FunctionDeviceForm(rng As Range) As String
> >     If UCase(rng.Value) = "X" Then
> >         frmDevices.Show
> >     End If
> > EndFunction
>
> > I'm using acustomform so the user can pick from drop-downs and I'll
> > update rows on a separate sheet.  I'm not sure if I'm headed down the
> > wrong path, but here's the code for that too.  I feel like I'm running
> > into something rookieish...  Can anyone spot it?
>
> > Private Sub cmbAddDevice_Click()
>
> >     ActiveWorkbook.Sheets("TABLES").Range("B2").Value = cmb1.Value
>
> > End Sub
>
> > Private Sub cmdClear_Click()
> >     cmb1.Value = ""
> >     cmb2.Value = ""
> >     cmb3.Value = ""
> >     cmb4.Value = ""
> >     cmb5.Value = ""
> >     cmb6.Value = ""
> >     cmb7.Value = ""
> > End Sub
>
> > Private Sub UserForm_Initialize()
> >     Dim arrDropDownVals As Variant
>
> >     'Variables for drop-downs
> >     arrDropDownVals = Array("S", "O", "G")
>
> >     With Me.cmb1
> >         .Clear
> >         For i = 0 To UBound(arrDropDownVals)
> >             .AddItem arrDropDownVals(i)
> >         Next i
> >         .ListIndex = 0
> >     End With
>
> >     With Me.cmb2
> >         .Clear
> >         For i = 0 To UBound(arrDropDownVals)
> >             .AddItem arrDropDownVals(i)
> >         Next i
> >         .ListIndex = 0
> >     End With
>
> >     With Me.cmb3
> >         .Clear
> >         For i = 0 To UBound(arrDropDownVals)
> >             .AddItem arrDropDownVals(i)
> >         Next i
> >         .ListIndex = 0
> >     End With
>
> >     With Me.cmb4
> >         .Clear
> >         For i = 0 To UBound(arrDropDownVals)
> >             .AddItem arrDropDownVals(i)
> >         Next i
> >         '.ListIndex = 0
> >     End With
>
> >     With Me.cmb5
> >         .Clear
> >         For i = 0 To UBound(arrDropDownVals)
> >             .AddItem arrDropDownVals(i)
> >         Next i
> >         '.ListIndex = 0
> >     End With
>
> >     With Me.cmb6
> >         .Clear
> >         For i = 0 To UBound(arrDropDownVals)
> >             .AddItem arrDropDownVals(i)
> >         Next i
> >         '.ListIndex = 0
> >     End With
>
> >     With Me.cmb7
> >         .Clear
> >         For i = 0 To UBound(arrDropDownVals)
> >             .AddItem arrDropDownVals(i)
> >         Next i
> >         '.ListIndex = 0
> >     End With
> > End Sub
>
> > Cheers,
> > Matt
>
> > --
> >-------------------------------------------------------------------------- 
> >--------
> >-
> > Some important links for excel users:
> > 1. Follow us on TWITTER for tips tricks and links :
> >http://twitter.com/exceldailytip
> > 2. Join our LinkedIN group @http://www.linkedin.com/groups?gid=1871310
> > 3. Excel tutorials athttp://www.excel-macros.blogspot.com
> > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com
> > 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com
>
> > To post to this group, send email to excel-macros@googlegroups.com
>
> > <><><><><><><><><><><><><><><><><><><><><><>
> > Like our page on facebook , Just follow below link
> >http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&;...

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&ref=ts

Reply via email to