caddraftsman
New Member
- Joined
- Sep 5, 2011
- Messages
- 1
I have attached my code below, I found an example and made it fit what I needed to do. The code works but I was wondering if there is a way of simplifying it. As you can see below if it finds say 106 1/2 IRF i want it to put those four values on the same row in the specified column numbers. I really have no experience with coding and this code works it just seems like a lot of code that I hope can be shortened up. I work with csv files everyday in the surveying field and am trying to automate finding and replacing multiple entries of the same kind. In each file we might have 1000 to 2000 entries. Basically we are using old point descriptions and converting them to our standard description with attribute data. Also if you have any other suggestions I am all ears.
Thanks for your help in advance,
Justin
Sub Autpen()
'
' Autpen Macro
'
' Keyboard Shortcut: Ctrl+Shift+W
'
Dim limit As Long
Dim c As Long
limit = Cells(Rows.Count, 1).End(xlUp).Row
For c = 1 To limit
If Cells(c, 5) = "105 FND PK" Then Cells(c, 7) = "NAIL"
If Cells(c, 5) = "105 FND PK" Then Cells(c, 5) = "MON"
If Cells(c, 5) = "106 1/2 IRF" Then Cells(c, 7) = "REBAR"
If Cells(c, 5) = "106 1/2 IRF" Then Cells(c, 8) = "0.5"
If Cells(c, 5) = "106 1/2 IRF" Then Cells(c, 9) = "FND"
If Cells(c, 5) = "106 1/2 IRF" Then Cells(c, 5) = "MON"
Next c
End Sub
Thanks for your help in advance,
Justin
Sub Autpen()
'
' Autpen Macro
'
' Keyboard Shortcut: Ctrl+Shift+W
'
Dim limit As Long
Dim c As Long
limit = Cells(Rows.Count, 1).End(xlUp).Row
For c = 1 To limit
If Cells(c, 5) = "105 FND PK" Then Cells(c, 7) = "NAIL"
If Cells(c, 5) = "105 FND PK" Then Cells(c, 5) = "MON"
If Cells(c, 5) = "106 1/2 IRF" Then Cells(c, 7) = "REBAR"
If Cells(c, 5) = "106 1/2 IRF" Then Cells(c, 8) = "0.5"
If Cells(c, 5) = "106 1/2 IRF" Then Cells(c, 9) = "FND"
If Cells(c, 5) = "106 1/2 IRF" Then Cells(c, 5) = "MON"
Next c
End Sub