Hi all,
Context:
1. M3 is a a variable number >0
2. The rest of columns M as well as columns N and A;J are IRRELEVANT.
Objectives:
1. I'd like to clear the columns K4 to L(Value of M3 + 2);
2. Increment the values 1 by 1 in column K. Starting with K3=0, K4=1, K5=2, ... , K(Value of M3+2)=Value of M3-1. So in this case it would be K202=199
3. Copy value from L3 through ALL lines of L till the column K stops incrementing.
4. Plot a graph from the columns K3 to L(Value of M3 + 3). Remember that the value is variable.
(IMAGE 1)
https://pasteboard.co/HOd3ocr.png
Current situation
This is the macro I have for deleting columns and then incrementing 1 by 1.
Result
Besides clearing the whole sheet, which I don't want... (continues below)
(IMAGE 2)
https://pasteboard.co/HOd4Zyr.png
It is also not stopping to increment after K reaches its intended value. It goes on and on.
(IMAGE 3)
https://pasteboard.co/HOd5l70.png
Solutions needed
1. Fix clearing for the intended area instead of the whole sheet.
2. Fix incrementation to stop at the desired value on columns K and L.
3. Plot a line graph of these everchanging columns (100% NOT DONE).
Thank you in advance for your time and help!
Context:
1. M3 is a a variable number >0
2. The rest of columns M as well as columns N and A;J are IRRELEVANT.
Objectives:
1. I'd like to clear the columns K4 to L(Value of M3 + 2);
2. Increment the values 1 by 1 in column K. Starting with K3=0, K4=1, K5=2, ... , K(Value of M3+2)=Value of M3-1. So in this case it would be K202=199
3. Copy value from L3 through ALL lines of L till the column K stops incrementing.
4. Plot a graph from the columns K3 to L(Value of M3 + 3). Remember that the value is variable.
(IMAGE 1)
https://pasteboard.co/HOd3ocr.png
Current situation
This is the macro I have for deleting columns and then incrementing 1 by 1.
Code:
[/COLOR][COLOR=#333333]Sub IncrementB()[/COLOR]
<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit; line-height: 12px;">Dim x, i&, ii&, j&, k&, z()
With Sheets("AidCalc1")
x = .Range("K3", .Cells(.Rows.Count, "N").End(3)).Value
ReDim z(1 To Application.Sum(Application.Index(x, 0, 3)), 1 To UBound(x, 2))
For i = 1 To UBound(x)
If Len(x(i, 3)) Then
k = 0
For ii = 1 To Val(x(i, 3))
j = j + 1
z(j, 1) = k
z(j, 2) = x(1, 2)
z(j, 3) = x(i, 3)
z(j, 4) = x(i, 4)
k = k + 1
Next ii
End If
Next i
.UsedRange.ClearContents
.[k3].Resize(UBound(z, 1), 4) = z
End With </code>[COLOR=#333333]End Sub[/COLOR][COLOR=#333333]
Result
Besides clearing the whole sheet, which I don't want... (continues below)
(IMAGE 2)
https://pasteboard.co/HOd4Zyr.png
It is also not stopping to increment after K reaches its intended value. It goes on and on.
(IMAGE 3)
https://pasteboard.co/HOd5l70.png
Solutions needed
1. Fix clearing for the intended area instead of the whole sheet.
2. Fix incrementation to stop at the desired value on columns K and L.
3. Plot a line graph of these everchanging columns (100% NOT DONE).
Thank you in advance for your time and help!