Form Issue

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,284
Office Version
  1. 365
Platform
  1. Windows
HI Team,

I have created this form since last 3-4 months and working all well..
I dont understading now, suddenly it is not working.

Sheet 3 has activex control command button. On button click, Userform1.Show written.

but now from last 10 mins it is showing me, RUN TIME ERROR 13, type mismatch....LOL

How do i get solve this..
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
ohhh...in name property of Form, "Userform1 " done. May b mistnkly update or key pressed...GOT IT...COOL
 
Upvote 0
Ok, just small help require on the same..
On the form, I have taken combo box. and trying to set Col A data in it.

Workbook name - Copy of Timesheet_H&B
worksheet name - Sheet2

how do i achieve that in below code..

Code:
Dim iA As Long
iA = Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row
ComboBox1.RowSource = Worksheets("Sheet2").Range("A2:A" & iA)
 
Upvote 0
Try this:

Code:
ComboBox1.RowSource = "'[Timesheet_H&B.[B][COLOR=#ff0000]xlsx[/COLOR][/B]]Sheet2'!$A$1:$A" & iA

You'll have to change "xlsx" to whatever type of file your workbook Timesheet_H&B is.
 
Upvote 0
Thanks for this..
But code for this..
Code:
iA = Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row
 
Upvote 0
I have designed like this now..
Code:
Dim iA As Long
iA = Workbooks("Timesheet_H&B.xlsm").Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row
cmbActivity.RowSource = "'[Timesheet_H&B.xlsm]Sheet2'!$A$2:$A" & iA

Tested iA in another module too, to see whether value taking in variable or not. iA taking value correctly. But in Form combo box, values are not listed...
 
Upvote 0
If the names of your combobox, workbook and worksheet are correct, what you have there should work. Only other thing to try would be to put the UserForm name in front of cmbActivity...such as:

Code:
FrmName.cmbActivity.Rowsource =..................

It depends on where the code is as to whether that's needed or if you could just use "Me" instead of the form name, but it's always safe to use the full name, even if it's located where "Me" would work or where it's not needed at all.
 
Last edited:
Upvote 0
Yes, not its work...by putting form name..Cheers...Thanks so much for your prompt answers...Bless you
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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