Consulting

Results 1 to 5 of 5

Thread: Copying values from a dynamic range

  1. #1

    Copying values from a dynamic range

    Hi Experts,

    I hereby ask for your assistance once again. I have following code that will copy contents one cell to left of active cell then one cell up.
    However what I really want is when I go one cell to left ("A"), look in above cells, split on ":" and copy values to right of split (1) of FIRST cell with value encountered


    [VBA]t.Cell(lngNrOfRows, 2).Range.Text = Format(Range("B" & rng.Row).Offset(-1, -1).Text)[/VBA]

    Any ideas?

  2. #2
    VBAX Mentor
    Joined
    Jul 2012
    Posts
    398
    Location
    attach a sample file with comments and desired result

  3. #3
    Test.xlsx

    Hi Patel. Please find attached with comments

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    [VBA]Option Explicit
    Sub SplitProject()
    Dim r As Long, i As Long
    r = Cells(Rows.Count, 2).End(xlUp).Row
    For i = r To 2 Step -1
    If Cells(i, 2) <> "" Then Cells(i, 1).Formula = Split(Cells(i, 1).End(xlUp), ":")(1)
    Next
    End Sub
    [/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  5. #5
    Many thanks MDM. I'll give this a go tomorrow!


Posting Permissions

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