-
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?
-
attach a sample file with comments and desired result
-
Test.xlsx
Hi Patel. Please find attached with comments
-
[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'
-
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
-
Forum Rules