Hello,
i'm completely new to VBA
I receive the following error 1004 Application-defined or object-defined error.
the following code is processing this error.
Cells(1, lastcol + 1) = "xxxxxx"
Columns(lastcol + 1).NumberFormat = "0%"
lastcol = .Cells(1, .Columns.Count).End(xlToLeft).Column
lastRow = .Cells(Rows.Count, "A").End(xlUp).Row
For r = 2 To lastRow
'Range(.Cells(r, lastcol), .Cells(lastRow, lastcol)).Formula = "=100%-M2"
'Range(.Cells(r, lastcol + 1), .Cells(lastRow, lastcol + 1)).Formula = "=100%-(" & .Cells(r, lastcol) = .Cells(r, lastcol)
Range(.Cells(r, lastcol), .Cells(lastRow, lastcol)).Formula = "=100%-(" & .Cells(r, lastcol - 1) & ")"
Next
What needs to be accomplished is that assumes that he is 100% minus the value in the previous cell is value in cell
[TABLE="width: 500"]
<tbody>[TR]
[TD]a[/TD]
[TD]b[/TD]
[TD]c[/TD]
[TD]d[/TD]
[/TR]
[TR]
[TD]50[/TD]
[TD]36[/TD]
[TD]73%[/TD]
[TD]=100%-c1=d%[/TD]
[/TR]
</tbody>[/TABLE]
Can somebody help me here
Rgds,
John
i'm completely new to VBA
I receive the following error 1004 Application-defined or object-defined error.
the following code is processing this error.
Cells(1, lastcol + 1) = "xxxxxx"
Columns(lastcol + 1).NumberFormat = "0%"
lastcol = .Cells(1, .Columns.Count).End(xlToLeft).Column
lastRow = .Cells(Rows.Count, "A").End(xlUp).Row
For r = 2 To lastRow
'Range(.Cells(r, lastcol), .Cells(lastRow, lastcol)).Formula = "=100%-M2"
'Range(.Cells(r, lastcol + 1), .Cells(lastRow, lastcol + 1)).Formula = "=100%-(" & .Cells(r, lastcol) = .Cells(r, lastcol)
Range(.Cells(r, lastcol), .Cells(lastRow, lastcol)).Formula = "=100%-(" & .Cells(r, lastcol - 1) & ")"
Next
What needs to be accomplished is that assumes that he is 100% minus the value in the previous cell is value in cell
[TABLE="width: 500"]
<tbody>[TR]
[TD]a[/TD]
[TD]b[/TD]
[TD]c[/TD]
[TD]d[/TD]
[/TR]
[TR]
[TD]50[/TD]
[TD]36[/TD]
[TD]73%[/TD]
[TD]=100%-c1=d%[/TD]
[/TR]
</tbody>[/TABLE]
Can somebody help me here
Rgds,
John