Hello,
im having an issue, what im whant to achive is this. i want to be able to select ranges depending on the content of the cells in column A, and then copy the higest number in the same rows in column C. so lets say the data look like this
A B C
hello 3
hello 5
hello 6
hello 8
hey 2
hey 9
yo 10
yo 7
yo 15
what i then want, is to print the value 8 to a spesefic location and then print the number 9 to an other location, and the number 15 to an other location again. the data may not look like this and the length of the collumns is always different so the macro needs to be totaly dynamic.
hope it is possible to understand what i want to be able to achive.
im a total newbie to Vba, and i am grateful for any help.
It is possible to write a macro but it is becoming complicated.
Sub test()
Dim j As Integer, k As Integer, rng As Range
Worksheets("sheet2").Cells.Clear
Worksheets("sheet1").Activate
Set rng = Range(Range("d2"), Range("d2").End(xlToRight))
j = WorksheetFunction.Count(rng)
'MsgBox j
For k = 1 To j
Cells(Range("d2").Offset(0, k - 1).Value, "b").Copy Worksheets("sheet2").Cells(Rows.Count, "a").End(xlUp).Offset(1, 0)
Next k
End Sub
when you run the macro the number 5,7,10 are copied in sheet 2. modify the macro to suit you |