Copy cell value to multiple columns meeting useform listbox selection

belbc

New Member
Joined
Apr 22, 2023
Messages
15
Office Version
  1. 365
Platform
  1. Windows
I know this cannot be that hard but I do not know much about vba and such. I look around and usually find what I'm looking for from you all and then change it to make it work for me.
I have a workbook with several worksheet in it worksheet of emergency runs that I keep for pay for my firefighters. I have had this workbook for a few years now and was just trying to update it a little. I normally just click on the line and add the new run and put in each individuals pay for the run. Once done the pay and run info is automatically copied to appropriate sheets for a summary report. Like i said I'm trying to update this with a Data Entry Form.

The call entry part works well and populates the worksheet. The listbox on the right will populate with the names and call numbers of my firefighters. I do that with a RowSource property with a range name of "FFRoster". It shows some blanks line that I would like to remove but no big deal.

What I would like for to happen is when I click the "Save" button the info is placed in the worksheet "Master" and copy a value from a cell and paste it in the columns of the firefighters selected in the listbox.

I would like this "Pay/Run" value to be copied to all the columns of the firefighter that were selected in the listbox.
 

Attachments

  • Run List.png
    Run List.png
    115.6 KB · Views: 16
  • Userform.png
    Userform.png
    54.7 KB · Views: 17

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
It is hard to work with pictures. Could you upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary).
 
Upvote 0
It is hard to work with pictures. Could you upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary).
I will try
 
Upvote 0
Upvote 0
I'm having difficulty opening your file. Please make sure that it is a valid Excel file with an "xlsx" extension. Try saving it with a different shorter name. Then close it and re-open it to make sure it works.
 
Upvote 0
I'm having difficulty opening your file. Please make sure that it is a valid Excel file with an "xlsx" extension. Try saving it with a different shorter name. Then close it and re-open it to make sure it works.
Its an excel file extension .xlsm
 
Upvote 0
in the same row of new data
How do you determine which row is the row of new data? For example, let's say you selected Brad White whose name is in column L, which row would contain the desired Pay/Run? Please clarify in detail.
 
Upvote 0
How do you determine which row is the row of new data? For example, let's say you selected Brad White whose name is in column L, which row would contain the desired Pay/Run? Please clarify in detail.
As I enter the data of the new run it places the info at the bottom of the list or other data already there. If I enter info manually I start in Column A at the bottom of list and work across. I just started putting the Dispatch Time And In Quarters Time along with the pay on the front sheet here. I have some other sheets that when entered the runs go to the Runs sheet and other the pay info goes to the individuals pay sheets as well as the summary sheets.

So when the info is entered and i hit the save button the info from userform will be added to the bottom row of the list. The Total Time will be calculated from the Dispatch & In-Quarters Time. From there the Pay/Run is calculated depending how how long we have be on scene. What I want then would be to copy that Pay/Run(Column H) to the appropriate columns that correspond with the members selected back in the Listbox. Using either name or the call number which ever is the easiest to do.

This is the VBA language under the "Save" button on the cmdSave_Click

Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Master")
Dim le As Long
lr = Sheets("Master").Range("A" & Rows.Count).End(xlUp).Row

''''''''''''''Add data in Run List''''''''''''''
With sh
.Cells(lr + 1, "A").Value = Me.txtDate.Value
.Cells(lr + 1, "B").Value = Me.txtAddress.Value
.Cells(lr + 1, "C").Value = Me.cmbCallType.Value
.Cells(lr + 1, "D").Value = Me.txtDescription.Value
.Cells(lr + 1, "E").Value = Me.txtDispatch.Value
.Cells(lr + 1, "F").Value = Me.txtInQuarters.Value
.Cells(lr + 1, "I").Value = Me.txtRunNumber.Value
End With

''''''''''''''Clear Boxes'''''''''''''
Me.txtSearch.Value = ""
Me.txtDate.Value = ""
Me.txtAddress.Value = ""
Me.cmbCallType.Value = ""
Me.txtDescription.Value = ""
Me.txtDispatch.Value = ""
Me.txtInQuarters.Value = ""
Me.txtRunNumber.Value = ""

Call Refresh_data

MsgBox "Run has been added to Master list", vbInformation
txtDate.SetFocus



Not sure of this answers your question or not?
 
Upvote 0

Forum statistics

Threads
1,215,137
Messages
6,123,252
Members
449,093
Latest member
Vincent Khandagale

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