asked on
ASKER
ASKER
ASKER
Sub AutoMove()
Dim Cnt As Long
Sht = "Sheet1"
Sheets(Sht).Select
Cells.Select
Selection.ClearContents
Cnt = 0
Set Rng = Worksheets("UPS 07 ZONE CHART").Range("A7:A46")
For Each cel In Rng
If InStr(cel.Value, "-") > 0 Then
For i = Left(cel.Value, 3) To Right(cel.Value, 3)
Cnt = Cnt + 1
Worksheets(Sht).Cells(Cnt, 1).NumberFormat = "@"
Worksheets(Sht).Cells(Cnt, 1).Value = Format(i, "000")
Worksheets(Sht).Cells(Cnt, 2).Value = cel.Offset(0, 1).Value
Next i
Else
Cnt = Cnt + 1
Worksheets(Sht).Cells(Cnt, 1).NumberFormat = "@"
Worksheets(Sht).Cells(Cnt, 1).Value = Format(cel.Value, "000")
Worksheets(Sht).Cells(Cnt, 2).Value = cel.Offset(0, 1).Value
End If
Next cel
End Sub
ASKER
Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.
TRUSTED BY
It would be useful to see some sample data and/or a sample file. EE now allows you to directly upload files to your question.
Please be advised that once you upload a file, it can be publicly accessed, and that it may not be possible to fully and permanently delete it. The file may also be indexed by the major search engines.
Therefore, be very careful about posting proprietary, confidential, or other sensitive information. If necessary, use "fake" and/or obfuscated data in your sample.
Please note that at present EE restricts uploads to certain file types. If your file type does not match those in the list, you can use http://www.ee-stuff.com instead, which is not officially an EE site, but is run by people connected to EE.
Patrick