Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 1
Default Copy cell value and delete white spaces at the end?

Hi experts!

I made a little excel worksheet to make my daily work a little easier. (Excel 97)

Now I have a simple problem!

I have a macro applied to a button and when I click on it a cell is copied in the clipboard because I need the data in a different application. The date in the cell is variable and changes depending what I did before I hit the copy button.

The cell is filled like that:


Range("K35").Select
ActiveCell.FormulaR1C1 = ActiveCell.Value & Cells(1, 1)

That works great but when I paste the content from the clipboard in another application (ex. notepad) there are a lot of white spaces after the cell content. I need to delete this white spaces before I paste the value in the other application.

I tried a few times with "Trim" but with no success. I don't know much about macro programming.

To copy the cell with the macro, I select the cell and then I use the copy funtion.

How can I delete this white spaces?

Range("F5").Select
Selection.Copy

Thank you so much!

Regards,
Michael
  #2   Report Post  
Senior Member
 
Location: Hyderabad
Posts: 237
Thumbs up

Quote:
Originally Posted by gombi View Post
Hi experts!

I made a little excel worksheet to make my daily work a little easier. (Excel 97)

Now I have a simple problem!

I have a macro applied to a button and when I click on it a cell is copied in the clipboard because I need the data in a different application. The date in the cell is variable and changes depending what I did before I hit the copy button.

The cell is filled like that:


Range("K35").Select
ActiveCell.FormulaR1C1 = ActiveCell.Value & Cells(1, 1)

That works great but when I paste the content from the clipboard in another application (ex. notepad) there are a lot of white spaces after the cell content. I need to delete this white spaces before I paste the value in the other application.

I tried a few times with "Trim" but with no success. I don't know much about macro programming.

To copy the cell with the macro, I select the cell and then I use the copy funtion.

How can I delete this white spaces?

Range("F5").Select
Selection.Copy

Thank you so much!

Regards,
Michael
use clean and trim function at a time to clean the data properly

dim a as variant
a=activeworkbook.sheets("sheet1").range("F5")
Application.WorksheetFunction.Clean(Trim(a))
a.copy

or

directly the trim the data in the excel spreadsheet and use vba code to copy and paste it.

all the best
__________________
Thanks
Bala
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete spaces rexmann Excel Discussion (Misc queries) 4 March 7th 08 02:38 PM
An easy way to delete spaces in a cell... LEG New Users to Excel 3 November 12th 07 05:27 PM
how do I delete the last two spaces in a cell brantty Excel Discussion (Misc queries) 2 July 27th 06 01:14 AM
Remove white spaces in Back dziw Excel Discussion (Misc queries) 2 July 19th 06 06:48 PM
Delete Spaces and Join Text in Cell Diggsy Excel Worksheet Functions 3 October 5th 05 03:50 AM


All times are GMT +1. The time now is 03:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"