mysticmario
Active Member
- Joined
- Nov 10, 2021
- Messages
- 323
- Office Version
- 365
- Platform
- Windows
As the title says I have a sheet1 and sheet2 where I neeed to check if in range H193:H271 item count is more than 0 and if yes, then copy this value + two offset values to the left, into sheet2 in empty cell in range B11:B30 and C11:C30
and if that range is full then copy those values into empty cell in range of cells next to them in this case(K11:K30 and L11:L30)
This is so what I've got so far:
Of course this code doesn't work as intended it counts entie B and C column in sheet2 and it also does not combine values D and E together from sheet1.
Please also see attached screenshot for visual reference, and tips and suggestions will be a appreciated.
and if that range is full then copy those values into empty cell in range of cells next to them in this case(K11:K30 and L11:L30)
This is so what I've got so far:
VBA Code:
Dim Rng As Range, cell As Range, lr As Long
Set Rng = Range("H193:H271")
For Each cell In Rng
If Not IsEmpty(cell) And cell.Value <> 0 Then
'GET ELEMENT QTY '
lr = Sheets("KARTA REALIZACJI").Cells(Rows.Count, "C").End(xlUp).Row
cell.Copy
Sheets("Karta Realizacji").Cells(lr + 1, "C").PasteSpecial Paste:=xlPasteValues
'GET ELEMENT D+E'
lr = Sheets("KARTA REALIZACJI").Cells(Rows.Count, "C").End(xlUp).Row
cell.Offset(0, 2).Copy
Sheets("Karta Realizacji").Cells(lr + 1, "C").PasteSpecial Paste:=xlPasteValues
End If
Next cell
Please also see attached screenshot for visual reference, and tips and suggestions will be a appreciated.