Results 1 to 9 of 9

Thread: fill (2003)

  1. #1
    3 Star Lounger
    Join Date
    Jul 2005
    Location
    Bahrain
    Posts
    373
    Thanks
    1
    Thanked 0 Times in 0 Posts

    fill (2003)

    hi all,
    sample of the data i have is attached, what i want to do is for empty cells in last column(N) enter present data from previous column. for example for NUM 3 the data should be 739.

    tia
    TIA
    dubdub

  2. #2
    3 Star Lounger
    Join Date
    Jul 2005
    Location
    Bahrain
    Posts
    373
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: fill (2003)

    sorry,
    here is the file.
    TIA
    dubdub

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: fill (2003)

    Instead of posting a new reply to attach a file, you can edit your own post by clicking the <IMG SRC=http://www.wopr.com/w3timages/edit.gif> button in the post header.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: fill (2003)

    You can run the following macro

    Sub FillColumnN()
    Dim r As Long
    Dim c As Long
    For r = 2 To Cells(65536, 2).End(xlUp).Row
    If Cells(r, 14) = "" Then
    c = Cells(r, 14).End(xlToLeft).Column
    Cells(r, 14) = Cells(r, c)
    End If
    Next r
    End Sub

  5. #5
    3 Star Lounger
    Join Date
    Jul 2005
    Location
    Bahrain
    Posts
    373
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: fill (2003)

    Many thanks HansV,

    i have added more columns and i modified your macro, but i don't know why not working. i guess what i am asking is, is it possible to have it flexible, that is to say i can define the column to be filled ,and the range of columns for look up.

    regards,
    TIA
    dubdub

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: fill (2003)

    Assuming that the last entry in row 1 determines the column you want to fill, you can use this:

    Sub FillColumn()
    Dim r As Long
    Dim c As Long
    Dim n As Long
    ' Determine last column
    n = Cells(1, 256).End(xlToLeft).Column
    For r = 2 To Cells(65536, 2).End(xlUp).Row
    If Cells(r, n) = "" Then
    c = Cells(r, n).End(xlToLeft).Column
    Cells(r, n) = Cells(r, c)
    End If
    Next r
    End Sub

  7. #7
    3 Star Lounger
    Join Date
    Jul 2005
    Location
    Bahrain
    Posts
    373
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: fill (2003)

    Thanks Hans,

    this works fine with last column , but my data is sectioned by column, for example the 5 columns added could be a different data from the first 14 columns and as such column 19 has relation with only those 5 columns added before it.

    Regards,
    dubdub
    TIA
    dubdub

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: fill (2003)

    Try the code in the attached text file.

  9. #9
    3 Star Lounger
    Join Date
    Jul 2005
    Location
    Bahrain
    Posts
    373
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: fill (2003)

    Hans,
    many thanks for your patient and your help. it works great.

    dubdub
    TIA
    dubdub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •