VBA Remove blank space

Aretradeser

Board Regular
Joined
Jan 16, 2013
Messages
176
Office Version
  1. 2013
Platform
  1. Windows
I use a UserForm with several controls for data entry to an Excel sheet.
In one of the columns of this sheet, I enter the values of 3 linked TextBoxes: the first 2 values (TextBox2 and TextBox3), separated by a blank space. The third value (TextBox1), separated from the value of TextBox2 by a ",". The issue is that between the TextBox3 value and the "," there is a blank space and I need it not to be like that; that is, the last letter of the TextBox3 value to be followed by the "," with no blank spaces.
The values of the 3 TextBoxes are text.
VBA Code:
CODE:
With Worksheets("DATA")
            t = Cells(Rows.Count, 2).End(xlUp).Row
            Cells(t + 1, 2) = TextBox2 & " " & TextBox3 & ", " & TextBox1
            Cells(t + 1, 3) = ComboBox5
            Cells(t + 1, 4) = ComboBox6
 
Glad we could help & thanks for the feedback.
 
Upvote 0

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
just incase

VBA Code:
With Worksheets("DATA")
            t = Cells(Rows.Count, 2).End(xlUp).Row
            Cells(t + 1, 2) = TextBox2 & " " & trim(TextBox3) & ", " & TextBox1
            Cells(t + 1, 3) = ComboBox5
            Cells(t + 1, 4) = ComboBox6
Thank you for solving the question
 
Upvote 0
Your welcome, glad it worked for you.

Dave
 
Upvote 0

Forum statistics

Threads
1,214,984
Messages
6,122,601
Members
449,089
Latest member
Motoracer88

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