How to extract and add in integer using VBA?

esprit_y2k

New Member
Joined
Jan 17, 2006
Messages
5
How to use VBA in excel to change and amend the text in column A to a specific text based on certain criteria? (description in column A based on the number to multiply with column B and get the result in column A)

Example.
Column A = description (text)
Column B = Quantity

Column A1 consist of the following text: "Package 1, WD40, 20 units"
Column A2 consist of the following text: "Promotion - A4 Paper - 5 pieces"
Column A3 consist of the following text: "Best buy Pencil Box 100 units"

Column B1 consist of number (quantity): "2"
Column B2 consist of number (quantity): "5"
Column B3 consist of number (quantity): "1"

After the VBA coding;

Column A1 will become: "Package 1, WD40, 2 x 20 = 4 units"
Column A2 will become: "Promotion - A4 Paper - 5 x 5 = 25 pieces"
Column A3 will become: "Best buy Pencil Box 1 x 100 = 100 units"

Any help will be highly appreciated.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
It would have been easier if the database is designed uniformly. for e.g. units and pieces are used uniformly "units" could have been used.
Before the no. of unis are written in A1,A2 and A3 same punctuation(or delimiter) mark is used for e.g. ","
<table x:str="" style="border-collapse: collapse; width: 222pt;" width="296" border="0" cellpadding="0" cellspacing="0"><col style="width: 222pt;" width="296"> <tbody><tr style="height: 19.5pt;" height="26"> <td style="height: 19.5pt; width: 222pt;" width="296" height="26">Package 1, WD40, 20 units</td> </tr> <tr style="height: 19.5pt;" height="26"> <td style="height: 19.5pt;" height="26">Promotion - A4 Paper, 5 units</td> </tr> <tr style="height: 19.5pt;" height="26"> <td style="height: 19.5pt;" height="26">Best buy Pencil Box, 100 units

Then it would be easier to find a solution.

let me see whether anything can be done
</td> </tr> </tbody></table>
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,120
Members
451,399
Latest member
alchavar

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