View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
David David is offline
external usenet poster
 
Posts: 1,560
Default help with data parsing

'Start in cell D1
Sub Macro1()
Do Until ActiveCell.Offset(0, -2).Value = ""
ActiveCell.Offset(1, 0).Range("A1").Select
LongLength = Len(ActiveCell.Offset(0, -2).Value)
If LongLength = 0 Then End
If LongLength < 6 Then
RepeatNo = ActiveCell.Offset(0, -2).Value
RepeatTimes = ActiveCell.Offset(0, -1).Value
For Z = 1 To RepeatTimes
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveCell.Value = RepeatNo
Next Z
Z = 0
Else
End If
Loop
End Sub

ID Long Lat (D1)
1 9.5 4
2 -118.727 37.81862 9.5
3 -118.728 37.81875 9.5
4 -118.731 37.81907 9.5
5 -118.735 37.81995 9.5
6 10.5 3
7 -118.743 37.82292 10.5
8 -118.744 37.82338 10.5
9 -118.748 37.8261 10.5
Hope this helps.

"Param Dhillon" wrote:

Hi David,
The data is allready in the excel format. If you look on my second
thread its little more clear. Actaully 9.5 value will be repeated 4 times
and the 10.5 value will be repeated 3 times in a new colum called value.

PLease look under "After Data" and

ID 1

and

ID 6

Thanks
Param

After Data
ID Long Lat Value
1 ,9.5 ,4
2 ,-118.727, 37.81862, 9.5
3 -118.728, 37.81875, 9.5
4 -118.731, 37.81907 ,9.5
5 -118.735, 37.81995 ,9.5
6, 10.5 ,3
7 -118.743, 37.82292, 10.5
8 -118.744, 37.82338, 10.5
9 -118.748 ,37.8261, 10.5