PDA

View Full Version : Copying values from a dynamic range



Ray.Mason
04-09-2013, 08:09 AM
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


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

Any ideas?
:banghead:

patel
04-09-2013, 08:26 AM
attach a sample file with comments and desired result

Ray.Mason
04-09-2013, 09:07 AM
9850

Hi Patel. Please find attached with comments

mdmackillop
04-09-2013, 11:23 AM
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

Ray.Mason
04-09-2013, 01:52 PM
Many thanks MDM. I'll give this a go tomorrow!

:)