User form textbox to determine specific worksheet location for input data

Richard_mcr

New Member
Joined
Oct 19, 2023
Messages
8
Office Version
  1. 2019
Platform
  1. Windows
Hello All,

I'm a little stuck on some code and would appreciate some pointers please?

Basically, I'm using a user form to input task details. The tasks are assigned to individuals and the inputs go to a 'HandleData' worksheet. This all works great, however I would like to revise the method and have the input data save to a different worksheet based on a user form combo box value. The user form combo box is - cbo.***

I feel it should be simple, however cannot find the solution myself, or online...

Here's what I have so far that works, and below it my closest guess that returns an error:


*******************************************************************************************************************************************************************
'Save task and close button

Private Sub cmdAddClose_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("HandleData")

'Find first empty row in "HandleData" database using column 1

iRow = Worksheets("HandleData").Columns(1).Cells.Find(what:="*", SearchOrder:=xlRows, SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1

*******************************************************************************************************************************************************************

'Save task and close button

Private Sub cmdAddClose_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Me.cboAss.Value

'Find first empty row in "HandleData" database using column 1

iRow = Worksheets("HandleData").Columns(1).Cells.Find(what:="*", SearchOrder:=xlRows, SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1

*******************************************************************************************************************************************************************

Thanks in advance!!
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
A Worksheet object is not the same as a ComboBox value. You might use something like
VBA Code:
For Each ws In ThisWorkbook.Sheets
    If ws.Name = Me.cboAss.Value Then
        Set ws = ws
    End If
Next ws
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,953
Members
449,095
Latest member
nmaske

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