automatcally copy cells from above data automatically

Hazo69

New member
Local time
Today, 11:27
Joined
Apr 21, 2008
Messages
7
Can anyone help i have an excel spreedsheet that has several columns
the 1st cell in the job no, the 2nd cell in the address, the 3rd cell is the Code No., the 4th cell description of code no. and the 4th cell is the qty.
Problem is that the 1st & 2nd cells are one row and the 3rd, 4th & 5th cells are on the same row as 1st and 2nd but 3rd, 4th & 5th cell may be more than one row (see attached)

Is there a way that the 1st & 2nd cells can be automatically filled in for rows rows 1 and maybe 2

It will probably make sense when you look at the attached

PS i have about 1500 records like this
 

Attachments

  • Job.jpg
    Job.jpg
    30 KB · Views: 237
was this imported?

if you want to just loop through the sheet, and change them all, you could do something like this:
Code:
sub test()

dim x as integer

range("first cell").select

  for x = 2 to "number of the last row in the sheet"
    if activecell.value = "Same as Above" then
      activecell.value = offset(activecell, -1, 0)
    end if
  next x

end sub
 
Or
as the data is in cols a and b

Code:
Public Sub convert()
 Worksheets("sheetname").Columns("A:B").Select
For Each c In Selection
If c.Value = "same as above" Then
c.Value = c.Offset(-1, 0)
End If
Next c

End Sub

Brian
 

Users who are viewing this thread

Back
Top Bottom