Is this asking too much of a macro

dovaka

New Member
Joined
Aug 17, 2016
Messages
8
Im trying to get these tasks accomplished in excel but I think I am asking to much of a macro. I know some of these things are easy but others are kicking my butt. But im sure someone out there knows better then me about it. I tried to explain it as well as I could but feel free to ask any follow up questions.

sample file
https://www.dropbox.com/s/km28pniwi5al79p/mr excel.csv?dl=0

[FONT=&quot]1. Have it save all these columns and delete all others.[/FONT]
[FONT=&quot]Contact ID, Contact Type, Source, Primary FirstName, Primary LastName, Company, Primary Birthday, Email Address, Home Phone, Bus Phone, Mobile Phone, Contact Notes, House Number, Street, Street Designator, Suite No, City, State, Zip, [/FONT]

[FONT=&quot]2. merge the data from “House Number, Street, Street Designator” into a single cell called “address[/FONT]

[FONT=&quot]3. There are places where there is a line break or carriage return in a single cell. These need to be removed and converted to something like a * so that the cell ends up being one single line[/FONT]

[FONT=&quot]4. In Field “Zip” please force a 5 digit number. Where we are all our zip codes start with a 0 zip excel removes it. Set it so that if the zip is a 4 digit number that it will put a 0 at the beginning[/FONT]

[FONT=&quot]5. Field “Contact ID” is the identifier of each person. The number in this field is duplicated several times for some people because of the way the export handles certain notes for each user. Most of the data is the same between two rows with the same ID, the main row has data in the “Contact, Source” fields and the other rows that have the same “Contact ID” are the notes. I only need the addresses from the secondary rows moved into the “Notes” field of the primary row[/FONT]
 
Think it might be a character 13. Try this
Code:
Sub CleanUpData()

   Dim usdRws As Long
   
   usdRws = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row

   Range("D:D,G:N,P:P,S:W,Y:Z,AB:AJ,AL:AT,AW:CI,CK:CK,CN:CN,CP:CQ,CS:CS,CV:IK").Delete
   With Range("P2:P" & usdRws)
      .Value = Evaluate(.Offset(, -2).Address & " & "" "" & " & .Offset(, -1).Address & "& "" "" & " & .Address)
      .Value = Application.trim(.Value)
   End With
   Range("P1").Value = "Address"
   Range("N:O").Delete
   Range("R:R").NumberFormat = "00000"
   Cells.Replace Chr(13), " ", xlPart, , , , False, False
End Sub

Excel on my MACapparentlyy doesnt want to work with macros for some reason so ill have to give this a go later when im on my windows computer
 
Upvote 0

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
MAC VBA dosen't support the entire Windows VBA set
 
Upvote 0

Forum statistics

Threads
1,215,479
Messages
6,125,043
Members
449,206
Latest member
Healthydogs

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