My For loop won't delete the cells that match the nested If requirements
I finally got this to work and I am happier for it but I need to take it to the next level for chart building. As you can see it progresses through the columns and rows and clears a pair of cells. When I try to make a chart of the full row it comes up with gaps in it because of the cleared cells. There is a "with" statement going on here but its just a reference to another sheet since the code is being executed from a different sheet; pushing as opposed to pulling.
LCcfd = .Standard Last Column code. The cfd referst to the abv. of a sheet.
Lrcfd = .Standard Last Row code. The cfd refers to the abv. of a sheet.
For x = 2 to LRcfd Step 2
CF = 2
For Each cel in .Range(.Cells(x, 2), .Cells(x, LCcfd))
If cel = 0 Or cel = "0" Then
cel.Clear
.Cells(x - 1, CF).Clear
End If
CF = CF + 1
Next
Next
To take it to the next level I tried to change the .Clear
to .Delete Shift:=xlShiftToLeft
and it is NOT working as expected at all. I figured this was because it is progressing in the columns from left to right. I attempted to write the code so it goes through Each backwards but it will not accept a Step -1
. So, I don't know how to do that.
What can I do to this code to make it step backwards through the rows? Or:
What can you recommend I change the code to, to make this happen?
excel vba
add a comment |
I finally got this to work and I am happier for it but I need to take it to the next level for chart building. As you can see it progresses through the columns and rows and clears a pair of cells. When I try to make a chart of the full row it comes up with gaps in it because of the cleared cells. There is a "with" statement going on here but its just a reference to another sheet since the code is being executed from a different sheet; pushing as opposed to pulling.
LCcfd = .Standard Last Column code. The cfd referst to the abv. of a sheet.
Lrcfd = .Standard Last Row code. The cfd refers to the abv. of a sheet.
For x = 2 to LRcfd Step 2
CF = 2
For Each cel in .Range(.Cells(x, 2), .Cells(x, LCcfd))
If cel = 0 Or cel = "0" Then
cel.Clear
.Cells(x - 1, CF).Clear
End If
CF = CF + 1
Next
Next
To take it to the next level I tried to change the .Clear
to .Delete Shift:=xlShiftToLeft
and it is NOT working as expected at all. I figured this was because it is progressing in the columns from left to right. I attempted to write the code so it goes through Each backwards but it will not accept a Step -1
. So, I don't know how to do that.
What can I do to this code to make it step backwards through the rows? Or:
What can you recommend I change the code to, to make this happen?
excel vba
1
where is "x" utilized?
– Cyril
Jan 2 at 19:44
1
Where's yourWith
statement? Also, you don't need theElse
statement. Just end theIf
statement after.Clear
, then do theCF = CF + 1
– BruceWayne
Jan 2 at 19:45
Thank you for pointing out the "x"; fixed that. The PC was supposed to be replaced by the "x." Thank you @BruceWayne for clearing the useless Else statement. When a problem causes me a lot of grief I seem to do worse coding.
– Don of the Dead
Jan 4 at 14:47
Seems like you ignored Cyril's comment bellow. Please see stackoverflow.com/help/someone-answers
– Slai
Jan 5 at 8:40
add a comment |
I finally got this to work and I am happier for it but I need to take it to the next level for chart building. As you can see it progresses through the columns and rows and clears a pair of cells. When I try to make a chart of the full row it comes up with gaps in it because of the cleared cells. There is a "with" statement going on here but its just a reference to another sheet since the code is being executed from a different sheet; pushing as opposed to pulling.
LCcfd = .Standard Last Column code. The cfd referst to the abv. of a sheet.
Lrcfd = .Standard Last Row code. The cfd refers to the abv. of a sheet.
For x = 2 to LRcfd Step 2
CF = 2
For Each cel in .Range(.Cells(x, 2), .Cells(x, LCcfd))
If cel = 0 Or cel = "0" Then
cel.Clear
.Cells(x - 1, CF).Clear
End If
CF = CF + 1
Next
Next
To take it to the next level I tried to change the .Clear
to .Delete Shift:=xlShiftToLeft
and it is NOT working as expected at all. I figured this was because it is progressing in the columns from left to right. I attempted to write the code so it goes through Each backwards but it will not accept a Step -1
. So, I don't know how to do that.
What can I do to this code to make it step backwards through the rows? Or:
What can you recommend I change the code to, to make this happen?
excel vba
I finally got this to work and I am happier for it but I need to take it to the next level for chart building. As you can see it progresses through the columns and rows and clears a pair of cells. When I try to make a chart of the full row it comes up with gaps in it because of the cleared cells. There is a "with" statement going on here but its just a reference to another sheet since the code is being executed from a different sheet; pushing as opposed to pulling.
LCcfd = .Standard Last Column code. The cfd referst to the abv. of a sheet.
Lrcfd = .Standard Last Row code. The cfd refers to the abv. of a sheet.
For x = 2 to LRcfd Step 2
CF = 2
For Each cel in .Range(.Cells(x, 2), .Cells(x, LCcfd))
If cel = 0 Or cel = "0" Then
cel.Clear
.Cells(x - 1, CF).Clear
End If
CF = CF + 1
Next
Next
To take it to the next level I tried to change the .Clear
to .Delete Shift:=xlShiftToLeft
and it is NOT working as expected at all. I figured this was because it is progressing in the columns from left to right. I attempted to write the code so it goes through Each backwards but it will not accept a Step -1
. So, I don't know how to do that.
What can I do to this code to make it step backwards through the rows? Or:
What can you recommend I change the code to, to make this happen?
excel vba
excel vba
edited Jan 3 at 14:47
Don of the Dead
asked Jan 2 at 19:33
Don of the DeadDon of the Dead
112
112
1
where is "x" utilized?
– Cyril
Jan 2 at 19:44
1
Where's yourWith
statement? Also, you don't need theElse
statement. Just end theIf
statement after.Clear
, then do theCF = CF + 1
– BruceWayne
Jan 2 at 19:45
Thank you for pointing out the "x"; fixed that. The PC was supposed to be replaced by the "x." Thank you @BruceWayne for clearing the useless Else statement. When a problem causes me a lot of grief I seem to do worse coding.
– Don of the Dead
Jan 4 at 14:47
Seems like you ignored Cyril's comment bellow. Please see stackoverflow.com/help/someone-answers
– Slai
Jan 5 at 8:40
add a comment |
1
where is "x" utilized?
– Cyril
Jan 2 at 19:44
1
Where's yourWith
statement? Also, you don't need theElse
statement. Just end theIf
statement after.Clear
, then do theCF = CF + 1
– BruceWayne
Jan 2 at 19:45
Thank you for pointing out the "x"; fixed that. The PC was supposed to be replaced by the "x." Thank you @BruceWayne for clearing the useless Else statement. When a problem causes me a lot of grief I seem to do worse coding.
– Don of the Dead
Jan 4 at 14:47
Seems like you ignored Cyril's comment bellow. Please see stackoverflow.com/help/someone-answers
– Slai
Jan 5 at 8:40
1
1
where is "x" utilized?
– Cyril
Jan 2 at 19:44
where is "x" utilized?
– Cyril
Jan 2 at 19:44
1
1
Where's your
With
statement? Also, you don't need the Else
statement. Just end the If
statement after .Clear
, then do the CF = CF + 1
– BruceWayne
Jan 2 at 19:45
Where's your
With
statement? Also, you don't need the Else
statement. Just end the If
statement after .Clear
, then do the CF = CF + 1
– BruceWayne
Jan 2 at 19:45
Thank you for pointing out the "x"; fixed that. The PC was supposed to be replaced by the "x." Thank you @BruceWayne for clearing the useless Else statement. When a problem causes me a lot of grief I seem to do worse coding.
– Don of the Dead
Jan 4 at 14:47
Thank you for pointing out the "x"; fixed that. The PC was supposed to be replaced by the "x." Thank you @BruceWayne for clearing the useless Else statement. When a problem causes me a lot of grief I seem to do worse coding.
– Don of the Dead
Jan 4 at 14:47
Seems like you ignored Cyril's comment bellow. Please see stackoverflow.com/help/someone-answers
– Slai
Jan 5 at 8:40
Seems like you ignored Cyril's comment bellow. Please see stackoverflow.com/help/someone-answers
– Slai
Jan 5 at 8:40
add a comment |
2 Answers
2
active
oldest
votes
Will try to give an example, though I don't know your exact criteria for your range (variables which aren't displayed in your posted code)
dim r as long, c as long
for r = 10 to 1 step -1
for c = 10 to 1 step -1
if cells(r,c).value = 0 or cells(r,c).value = "0" then cells(r,c).delete shift:=xltoleft
next c
next r
Thanks @Cyril. I like the way you contstructed the nested For and use of "r" and "c" for variables; mine were confusing me sometimes and this made it so much simplier. I did have to modify it slightly but going off of what you had you gave me the right answer. All I really needed was the "shift:=xlToLeft" and it worked perfectly.
– Don of the Dead
Jan 4 at 14:50
Speaking of which. What is the difference, if any, between: Shift:=xlShiftToLeft and Shift:=xlToLeft? I appear to have gotten very different answers.
– Don of the Dead
Jan 4 at 14:51
I do not know about the difference between those; i have never used xlshifttoleft when i've coded in VBA for Excel. if that answers your question, please mark as answered (check mark on the left of the post).
– Cyril
Jan 4 at 15:19
add a comment |
Another approach is to write the evaluated content of the datasource to another worksheet (or Range) dedicated to serving your chart. This avoids the cell delete/shift manipulations and keeps yours source data intact - probably making debugging easier.
Sub GenerateChartDataFromSource()
Dim sourceWksht As Worksheet
Set sourceWksht = Application.Worksheets("Source")
Dim chartWksht As Worksheet
Set chartWksht = Application.Worksheets("ChartSource")
Dim sourceRow As Long, sourceColumn As Long
Dim chartSourceColumn As Long
Dim sourceContent As Variant
Dim sourceRowStart As Long, sourceRowEnd As Long
sourceRowStart = 1
sourceRowEnd = 10
Dim sourceColumnStart As Long, sourceColumnEnd As Long
sourceColumnStart = 1
sourceColumnEnd = 10
For sourceRow = sourceRowStart To sourceRowEnd
chartSourceColumn = sourceColumnStart
For sourceColumn = sourceColumnStart To sourceColumnEnd
sourceContent = sourceWksht.Cells(sourceRow, sourceColumn).value
If sourceContent <> 0 Or sourceContent <> "0" Then
chartWksht.Cells(sourceRow, chartSourceColumn) = sourceContent
chartSourceColumn = chartSourceColumn + 1
End If
Next sourceColumn
Next sourceRow
End Sub
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54012157%2fmy-for-loop-wont-delete-the-cells-that-match-the-nested-if-requirements%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Will try to give an example, though I don't know your exact criteria for your range (variables which aren't displayed in your posted code)
dim r as long, c as long
for r = 10 to 1 step -1
for c = 10 to 1 step -1
if cells(r,c).value = 0 or cells(r,c).value = "0" then cells(r,c).delete shift:=xltoleft
next c
next r
Thanks @Cyril. I like the way you contstructed the nested For and use of "r" and "c" for variables; mine were confusing me sometimes and this made it so much simplier. I did have to modify it slightly but going off of what you had you gave me the right answer. All I really needed was the "shift:=xlToLeft" and it worked perfectly.
– Don of the Dead
Jan 4 at 14:50
Speaking of which. What is the difference, if any, between: Shift:=xlShiftToLeft and Shift:=xlToLeft? I appear to have gotten very different answers.
– Don of the Dead
Jan 4 at 14:51
I do not know about the difference between those; i have never used xlshifttoleft when i've coded in VBA for Excel. if that answers your question, please mark as answered (check mark on the left of the post).
– Cyril
Jan 4 at 15:19
add a comment |
Will try to give an example, though I don't know your exact criteria for your range (variables which aren't displayed in your posted code)
dim r as long, c as long
for r = 10 to 1 step -1
for c = 10 to 1 step -1
if cells(r,c).value = 0 or cells(r,c).value = "0" then cells(r,c).delete shift:=xltoleft
next c
next r
Thanks @Cyril. I like the way you contstructed the nested For and use of "r" and "c" for variables; mine were confusing me sometimes and this made it so much simplier. I did have to modify it slightly but going off of what you had you gave me the right answer. All I really needed was the "shift:=xlToLeft" and it worked perfectly.
– Don of the Dead
Jan 4 at 14:50
Speaking of which. What is the difference, if any, between: Shift:=xlShiftToLeft and Shift:=xlToLeft? I appear to have gotten very different answers.
– Don of the Dead
Jan 4 at 14:51
I do not know about the difference between those; i have never used xlshifttoleft when i've coded in VBA for Excel. if that answers your question, please mark as answered (check mark on the left of the post).
– Cyril
Jan 4 at 15:19
add a comment |
Will try to give an example, though I don't know your exact criteria for your range (variables which aren't displayed in your posted code)
dim r as long, c as long
for r = 10 to 1 step -1
for c = 10 to 1 step -1
if cells(r,c).value = 0 or cells(r,c).value = "0" then cells(r,c).delete shift:=xltoleft
next c
next r
Will try to give an example, though I don't know your exact criteria for your range (variables which aren't displayed in your posted code)
dim r as long, c as long
for r = 10 to 1 step -1
for c = 10 to 1 step -1
if cells(r,c).value = 0 or cells(r,c).value = "0" then cells(r,c).delete shift:=xltoleft
next c
next r
answered Jan 2 at 19:48
CyrilCyril
2,9491924
2,9491924
Thanks @Cyril. I like the way you contstructed the nested For and use of "r" and "c" for variables; mine were confusing me sometimes and this made it so much simplier. I did have to modify it slightly but going off of what you had you gave me the right answer. All I really needed was the "shift:=xlToLeft" and it worked perfectly.
– Don of the Dead
Jan 4 at 14:50
Speaking of which. What is the difference, if any, between: Shift:=xlShiftToLeft and Shift:=xlToLeft? I appear to have gotten very different answers.
– Don of the Dead
Jan 4 at 14:51
I do not know about the difference between those; i have never used xlshifttoleft when i've coded in VBA for Excel. if that answers your question, please mark as answered (check mark on the left of the post).
– Cyril
Jan 4 at 15:19
add a comment |
Thanks @Cyril. I like the way you contstructed the nested For and use of "r" and "c" for variables; mine were confusing me sometimes and this made it so much simplier. I did have to modify it slightly but going off of what you had you gave me the right answer. All I really needed was the "shift:=xlToLeft" and it worked perfectly.
– Don of the Dead
Jan 4 at 14:50
Speaking of which. What is the difference, if any, between: Shift:=xlShiftToLeft and Shift:=xlToLeft? I appear to have gotten very different answers.
– Don of the Dead
Jan 4 at 14:51
I do not know about the difference between those; i have never used xlshifttoleft when i've coded in VBA for Excel. if that answers your question, please mark as answered (check mark on the left of the post).
– Cyril
Jan 4 at 15:19
Thanks @Cyril. I like the way you contstructed the nested For and use of "r" and "c" for variables; mine were confusing me sometimes and this made it so much simplier. I did have to modify it slightly but going off of what you had you gave me the right answer. All I really needed was the "shift:=xlToLeft" and it worked perfectly.
– Don of the Dead
Jan 4 at 14:50
Thanks @Cyril. I like the way you contstructed the nested For and use of "r" and "c" for variables; mine were confusing me sometimes and this made it so much simplier. I did have to modify it slightly but going off of what you had you gave me the right answer. All I really needed was the "shift:=xlToLeft" and it worked perfectly.
– Don of the Dead
Jan 4 at 14:50
Speaking of which. What is the difference, if any, between: Shift:=xlShiftToLeft and Shift:=xlToLeft? I appear to have gotten very different answers.
– Don of the Dead
Jan 4 at 14:51
Speaking of which. What is the difference, if any, between: Shift:=xlShiftToLeft and Shift:=xlToLeft? I appear to have gotten very different answers.
– Don of the Dead
Jan 4 at 14:51
I do not know about the difference between those; i have never used xlshifttoleft when i've coded in VBA for Excel. if that answers your question, please mark as answered (check mark on the left of the post).
– Cyril
Jan 4 at 15:19
I do not know about the difference between those; i have never used xlshifttoleft when i've coded in VBA for Excel. if that answers your question, please mark as answered (check mark on the left of the post).
– Cyril
Jan 4 at 15:19
add a comment |
Another approach is to write the evaluated content of the datasource to another worksheet (or Range) dedicated to serving your chart. This avoids the cell delete/shift manipulations and keeps yours source data intact - probably making debugging easier.
Sub GenerateChartDataFromSource()
Dim sourceWksht As Worksheet
Set sourceWksht = Application.Worksheets("Source")
Dim chartWksht As Worksheet
Set chartWksht = Application.Worksheets("ChartSource")
Dim sourceRow As Long, sourceColumn As Long
Dim chartSourceColumn As Long
Dim sourceContent As Variant
Dim sourceRowStart As Long, sourceRowEnd As Long
sourceRowStart = 1
sourceRowEnd = 10
Dim sourceColumnStart As Long, sourceColumnEnd As Long
sourceColumnStart = 1
sourceColumnEnd = 10
For sourceRow = sourceRowStart To sourceRowEnd
chartSourceColumn = sourceColumnStart
For sourceColumn = sourceColumnStart To sourceColumnEnd
sourceContent = sourceWksht.Cells(sourceRow, sourceColumn).value
If sourceContent <> 0 Or sourceContent <> "0" Then
chartWksht.Cells(sourceRow, chartSourceColumn) = sourceContent
chartSourceColumn = chartSourceColumn + 1
End If
Next sourceColumn
Next sourceRow
End Sub
add a comment |
Another approach is to write the evaluated content of the datasource to another worksheet (or Range) dedicated to serving your chart. This avoids the cell delete/shift manipulations and keeps yours source data intact - probably making debugging easier.
Sub GenerateChartDataFromSource()
Dim sourceWksht As Worksheet
Set sourceWksht = Application.Worksheets("Source")
Dim chartWksht As Worksheet
Set chartWksht = Application.Worksheets("ChartSource")
Dim sourceRow As Long, sourceColumn As Long
Dim chartSourceColumn As Long
Dim sourceContent As Variant
Dim sourceRowStart As Long, sourceRowEnd As Long
sourceRowStart = 1
sourceRowEnd = 10
Dim sourceColumnStart As Long, sourceColumnEnd As Long
sourceColumnStart = 1
sourceColumnEnd = 10
For sourceRow = sourceRowStart To sourceRowEnd
chartSourceColumn = sourceColumnStart
For sourceColumn = sourceColumnStart To sourceColumnEnd
sourceContent = sourceWksht.Cells(sourceRow, sourceColumn).value
If sourceContent <> 0 Or sourceContent <> "0" Then
chartWksht.Cells(sourceRow, chartSourceColumn) = sourceContent
chartSourceColumn = chartSourceColumn + 1
End If
Next sourceColumn
Next sourceRow
End Sub
add a comment |
Another approach is to write the evaluated content of the datasource to another worksheet (or Range) dedicated to serving your chart. This avoids the cell delete/shift manipulations and keeps yours source data intact - probably making debugging easier.
Sub GenerateChartDataFromSource()
Dim sourceWksht As Worksheet
Set sourceWksht = Application.Worksheets("Source")
Dim chartWksht As Worksheet
Set chartWksht = Application.Worksheets("ChartSource")
Dim sourceRow As Long, sourceColumn As Long
Dim chartSourceColumn As Long
Dim sourceContent As Variant
Dim sourceRowStart As Long, sourceRowEnd As Long
sourceRowStart = 1
sourceRowEnd = 10
Dim sourceColumnStart As Long, sourceColumnEnd As Long
sourceColumnStart = 1
sourceColumnEnd = 10
For sourceRow = sourceRowStart To sourceRowEnd
chartSourceColumn = sourceColumnStart
For sourceColumn = sourceColumnStart To sourceColumnEnd
sourceContent = sourceWksht.Cells(sourceRow, sourceColumn).value
If sourceContent <> 0 Or sourceContent <> "0" Then
chartWksht.Cells(sourceRow, chartSourceColumn) = sourceContent
chartSourceColumn = chartSourceColumn + 1
End If
Next sourceColumn
Next sourceRow
End Sub
Another approach is to write the evaluated content of the datasource to another worksheet (or Range) dedicated to serving your chart. This avoids the cell delete/shift manipulations and keeps yours source data intact - probably making debugging easier.
Sub GenerateChartDataFromSource()
Dim sourceWksht As Worksheet
Set sourceWksht = Application.Worksheets("Source")
Dim chartWksht As Worksheet
Set chartWksht = Application.Worksheets("ChartSource")
Dim sourceRow As Long, sourceColumn As Long
Dim chartSourceColumn As Long
Dim sourceContent As Variant
Dim sourceRowStart As Long, sourceRowEnd As Long
sourceRowStart = 1
sourceRowEnd = 10
Dim sourceColumnStart As Long, sourceColumnEnd As Long
sourceColumnStart = 1
sourceColumnEnd = 10
For sourceRow = sourceRowStart To sourceRowEnd
chartSourceColumn = sourceColumnStart
For sourceColumn = sourceColumnStart To sourceColumnEnd
sourceContent = sourceWksht.Cells(sourceRow, sourceColumn).value
If sourceContent <> 0 Or sourceContent <> "0" Then
chartWksht.Cells(sourceRow, chartSourceColumn) = sourceContent
chartSourceColumn = chartSourceColumn + 1
End If
Next sourceColumn
Next sourceRow
End Sub
edited Jan 4 at 22:47
answered Jan 4 at 16:33
BZngrBZngr
1513
1513
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54012157%2fmy-for-loop-wont-delete-the-cells-that-match-the-nested-if-requirements%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
where is "x" utilized?
– Cyril
Jan 2 at 19:44
1
Where's your
With
statement? Also, you don't need theElse
statement. Just end theIf
statement after.Clear
, then do theCF = CF + 1
– BruceWayne
Jan 2 at 19:45
Thank you for pointing out the "x"; fixed that. The PC was supposed to be replaced by the "x." Thank you @BruceWayne for clearing the useless Else statement. When a problem causes me a lot of grief I seem to do worse coding.
– Don of the Dead
Jan 4 at 14:47
Seems like you ignored Cyril's comment bellow. Please see stackoverflow.com/help/someone-answers
– Slai
Jan 5 at 8:40