EXPERT CHALLENGE: Cleaning Data By Copy The Range Into An Array

milwphil

Board Regular
Joined
Aug 1, 2010
Messages
120
Good morning!

I thought I had this issue resolved but the worksheet is reacting fairly slow and I'm not able to manipulate it the way I'd like to (the code requires that you select the cells and then run the macro).

Subsequently, I was told that I could "scrub" data by copying the range into an array, clean the text (removing any trailing spaces) in the array and then assign the array back to the spreadsheet.


Sounds easy for someone that's an expert, but for me--I'm struggling to understand how to make it happen.


To make matters worse, the range will have a lastRow that will vary pending on the data I'm using.


I mercifully beg to the collective wisdom of Mr. Excel for any suggestions/solutions.


Feedback is greatly appreciated!


Thanks,
Phil

 
Wow! Thank you for all of the responses! I think I'm closer, but I'm still getting debug errors.

CharlesChuckieCharles, with your last suggestion I received a 400 error. I'm not sure what that means.

Weaver, I tried your 2nd suggested code and there was a debug error stating "lr" was not defined.

MrKowz, If I'm understanding your question correctly. The column that has the data is C, but the data starts at row 11. The end column is Z and could extend to about 1000 rows (so Z1000). The data could vary from row 11 to row 1000 (or even further).
Any further suggestions?

I'm more than appreciative for your feedback already!

Thanks again!
Phil

Insert the line
Code:
dim lr as long
I'm guessing elsewhere in your module, you have the line
Code:
option explicit
 
Upvote 0

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Wow! Thank you! I tried this on some sample data and it appears to be doing what I need it to.

THANKS TO EVERYONE THAT PROVIDED SUGGESTIONS/FEEDBACK!

This forum never ceases to amaze me!

Thank you, thank you, thank you!

Phil
 
Upvote 0

Forum statistics

Threads
1,224,560
Messages
6,179,519
Members
452,921
Latest member
BBQKING

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