Userform called by variable

CsJHUN

Active Member
Joined
Jan 13, 2015
Messages
360
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
  2. Mobile
Hi guys,

I would like to make a simpla so-called main form, where the user can select which form has to be loaded for him/her, and pass some values to them from "main form"
I found this method and tried to apply into my code
Code:
Private Sub btn_frmOpen_Click()
Dim frm As Object 'also tried with Userform

'search for process
o_folyamat = Sheets("Rules").Range("1:1").Find(what:="Folyamatok:", lookat:=xlWhole).Column

'get how many process is in the list
frmname_row = Sheets("Rules").Range(columns(o_folyamat).Address).Find(cb_folyamat.Text).Row

'get the form name based on the value
frmname = Sheets("Rules").Cells(frmname_row, o_folyamat + 1).Value

' and here comes the debug
Set frm = CallByName(UserForms, "Add", VbMethod, frmname)

'follow values would be passed from main to selected form
frm.tb_date.Value = tb_date.Value
frm.cb_ShiftAC = cb_ShiftAC
frm.cb_sor = cb_sor
frm.cb_folyamat = cb_folyamat

'hide main and show selected form
Me.Hide
frm.Show vbModeless
End Sub

its not working, any advice welcome
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
not a single character changed, its working now :o driving me nuts
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,260
Members
452,627
Latest member
KitkatToby

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top