Text to Columns VBA

SoldierWalb

New Member
Joined
Feb 11, 2022
Messages
7
Office Version
  1. 365
Platform
  1. Windows
I have some information that is sent to me in a PDF document and I am needing to try and manipulate the data so that it works better for our operation team. When the data is first pasted into the excel document it places all the data into the first Column. I have written a Macro that when the person clicks a button it breaks the first column into multiple columns based on using a space as the delimiter. I currently have two issues with this Macro. First is the "There's already data here" message that pops up. There is no data getting over written so not sure why this is popping up. I would like to eliminate this pop up. The next issue I run into is sometimes the width contains inches. When this happens it detects the space between the foot measurement and the inch measurement and pushes everything to the next column. So in the example I have below you can see that on 36 & 37 the width show 15' and the Height shows 6". This is incorrect. The Width should be 15' 6" but I am not sure how to make this work. I am able to manually do this operation with using some formulas but wasn't sure if there was a way to correct this that someone may know about.
Pasted Data.PNG
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Welcome to the Board!

You can suppress the warning by placing this line of code above your Text To Columns code:
VBA Code:
    Application.DisplayAlerts = False

Just be sure to turn it back on again afterwards with this line:
VBA Code:
    Application.DisplayAlerts = True

Your issue with measurements presents a quandary.
When you have values like this in succession:
9' 18"
How are we to determine if that should be 9' for Width and 18" for Height, or it should be 9' 18" for Width?
 
Upvote 0
Solution
Welcome to the Board!

You can suppress the warning by placing this line of code above your Text To Columns code:
VBA Code:
    Application.DisplayAlerts = False

Just be sure to turn it back on again afterwards with this line:
VBA Code:
    Application.DisplayAlerts = True

Your issue with measurements presents a quandary.
When you have values like this in succession:
9' 18"
How are we to determine if that should be 9' for Width and 18" for Height, or it should be 9' 18" for Width?

I was able to suppress the warning by using the code you listed above. Thank you.
The Height for the product is always either 21" or 18". And as far as the Width is concerned you would never see 9' 18" cause that would become 10' 6". But I was able to use some formulas and the "Concatenate" formulas to accomplish what I wanted to with the combining of Foot measurement and the inch measurement. Now I have broken another piece of the workbook that I need to figure out what I did.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,681
Members
449,116
Latest member
HypnoFant

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