Results 1 to 11 of 11

Filling values from the column on left or right

Threaded View

  1. #1
    Forum Contributor
    Join Date
    11-11-2012
    Location
    Muscat, Oman
    MS-Off Ver
    Office 365
    Posts
    522

    Thumbs up Filling values from the column on left or right

    Hello Friends,
    This novice user of VBA is back with another problem. Being a fairly good user of excel I work on huge pivot table called Master File created from a very huge access table.
    I use this pivot table to cut paste info for various reports. Every time I cut and paste something my table looks like the sample shown below.
    I find spending a lot of time in writing a formula in excel which is =IF(A2=””,B1,A2) then I copy and paste it till the last line of data (sometimes in thousands of rows) this works fine for me but since I use this more often so I decided to write a small macro for myself as shown below
     Sub FillColumnFromLeft()
    '
    ' FillColumnFromLeft Macro
    ' Filling blanks of left column in a new column
    '
      Do Until Selection.Offset(-1, 1).Value = ""
        ActiveCell.FormulaR1C1 = "=IF(RC[-1]="""",R[-1]C,RC[-1])"
        ActiveCell.Offset(1, 0).Range("A1").Select
        Loop
    End Sub
    And this didn’t fill even a single cell for me forget about going down 2500 rows.
    I wonder if some expert can correct my formula above and guide me to understand coz after this I would want to write a code for picking up values from right column and do it till end.
    Regards/VKS
    Months Sales Person Item Sales area A Sales area B Sales area C
    Jan Jack a 1 5 2
    Jill a 2 3 1
    Bill a 0(0 is Blank in data) 9 6
    Tom a 5 1 1
    Sam a 1 2 1
    Feb Jack a 1 5 2
    Jill a 2 3 1
    Bill a 0(Blank in data) 9 6
    Tom a 5 1 1
    Sam a 1 2 1
    Attached Files Attached Files
    Last edited by VKS; 12-07-2012 at 06:01 AM. Reason: Solved

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1