Join & Replace Columns

nyrangers1994

New Member
Joined
Aug 30, 2011
Messages
17
I've got a couple different scenarios where I need help with writing vba for. I know I can do this via excel formulas and a manual approach, but I need to do it as a macro because my company's admin staff will need to do this on a daily basis so an automated works best.

In my first situation, I have two columns in my activesheet that have "Starting Date" and "Duration" as the column headings in Row 1. Starting Date is in column J and Duration is in column K. Currently my macro converts some of the raw data in the other columns and then turns the entire range of used cells from column A through column U into an Excel table (Listobject) which is referenced as "Table" in my current code.

I need to modify these columns within my Listobject by taking the Duration which is always a text field such that a typical value would be "4 weeks", and puts it on a new line within the Starting Date cell on a separate line, changes the column heading for Starting Date, and then deletes the Duration column, such that:

Starting DateDuration
01/01/134 weeks
02/02/136 weeks

<tbody>
</tbody>

Becomes:

Starting Date / Duration
01/01/13
4 weeks
02/02/13
6 weeks

<tbody>
</tbody>

In my second situation, I have two columns other columns in my Listobject called "Title" and "Number". They're both in Row 1, and Title is in column H, and Number is in column I. If the value within the number field is greater than 1, I need it to copy/paste it next to the Title surrounded by parantheses, but not delete the Number column such that:

TitleNumber
This is Title 11
This is Title 22

<tbody>
</tbody>

Becomes:

TitleNumber
This is Title 11
This is Title 2 (2)2

<tbody>
</tbody>

Thank you very much for any help, guidance, or suggested code that you can provide.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,215,492
Messages
6,125,115
Members
449,206
Latest member
burgsrus

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