Making multiple userform entries populate one cell

Nikeyg

New Member
Joined
Jan 22, 2018
Messages
15
I'm putting together a spreadsheet to compare trades from an external clearer to my company's internal processes.
For this there is a requirement to keep a mapping table updated so if we trade something new we can update our data and ensure everything matches.
Now, here's my code for the userform for the mapping table that puts the information into the table

Code:
Private Sub ToggleButton1_Click()    'Copy input values to sheet.
    Dim lRow As Long
    Dim ws As Worksheet
    Set ws = Worksheets("Contract mapping")
    lRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
    With ws
        .Cells(lRow, 1).Value = Me.txtMACCode.Value
        .Cells(lRow, 2).Value = Me.OurCode.Value
        .Cells(lRow, 3).Value = Me.CallPutFuture.Value
        .Cells(lRow, 4).Value = Me.Multiplier.Value


    End With
    'Clear input controls.
    Me.txtMACCode.Value = ""
    Me.OurCode.Value = ""
    Me.CallPutFuture.Value = ""
    Me.Multiplier.Value = ""
End Sub

This works perfectly. With a problem
Due to the nature of the data from both sides I need to make certain allowances, as such where the data is inputting with this line

I need it to actually include the data from ".Cells(lRow, 1).Value = Me.txtMACCode.Value" and ".Cells(lRow, 3).Value = Me.CallPutFuture.Value"
But ONLY if the returned entry in the box is 'C' or 'P' so, for instance if the first item is POC and the second item is P I want the cell to receive POCP.

Is this possible?
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Hi, I don't have an answer for you but I want to thank you for giving me my chuckle for the day with the following quote from your post...

This works perfectly. With a problem

Please take this in good-natured fun with no ill will intended, and at least you'll get a bump out of it (I waited all day to post).
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
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