VBA Cut-Paste copies only one row and not all the rows












0














I am trying a code here to match all the cells of the "M" column in Sheet1 and Sheet3, and copy and delete all the rows from Sheet1 that contain any value from Sheet3's "M" column. Also, I want the records to get copied into "Sheet2" (all records to be deleted) However, it is deleting all the records but copying only the first row and not all the required rows. I tried some solutions I found online, but with no luck. Could anyone please suggest what might be the problem.



Below is the code:



Sub DeleteRows()

Dim rng As Range
Dim r As Long
Dim lr1 As Long
Dim lr3 As Long
Dim str As Variant
Dim i As Long: i = 1

Application.ScreenUpdating = False


lr3 = Sheets("Sheet3").Cells(Rows.Count, "M").End(xlUp).Row

Set rng = Sheets("Sheet3").Range("M2:M" & lr3)


lr1 = Sheets("Sheet1").Cells(Rows.Count, "M").End(xlUp).Row

For r = lr1 To 2 Step -1

str = Sheets("Sheet1").Cells(r, "M")

If Application.WorksheetFunction.CountIf(rng, str) > 0 Then

Sheets("Sheet1").Range(Cells(r, "A"), Cells(r, "N")).Cut Sheets("Sheet2").Cells(i, "A")
Sheets("Sheet1").Range(Cells(r, "A"), Cells(r, "N")).Delete (xlShiftUp)
i = i + 1
End If
Next r

Application.ScreenUpdating = True

End Sub


Appreciate your help! Thanks in advance!










share|improve this question


















  • 1




    Bit hard to tell without seeing your data. Have you stepped through your code to see what's going on? You should add sheet references to all instances of Cells.
    – SJR
    Nov 12 '18 at 19:07










  • If you're using Cut, why do you need a Delete line?
    – dwirony
    Nov 12 '18 at 19:08










  • @dwirony cut doesn't remove the line, it leaves an empty area
    – Kubie
    Nov 12 '18 at 19:10












  • @Kubie perhaps dwirony was implying keep the delete and drop the cut...
    – Solar Mike
    Nov 12 '18 at 19:14










  • @SolarMike good point, in that case can change the cut to a range.value = range.value
    – Kubie
    Nov 12 '18 at 19:16
















0














I am trying a code here to match all the cells of the "M" column in Sheet1 and Sheet3, and copy and delete all the rows from Sheet1 that contain any value from Sheet3's "M" column. Also, I want the records to get copied into "Sheet2" (all records to be deleted) However, it is deleting all the records but copying only the first row and not all the required rows. I tried some solutions I found online, but with no luck. Could anyone please suggest what might be the problem.



Below is the code:



Sub DeleteRows()

Dim rng As Range
Dim r As Long
Dim lr1 As Long
Dim lr3 As Long
Dim str As Variant
Dim i As Long: i = 1

Application.ScreenUpdating = False


lr3 = Sheets("Sheet3").Cells(Rows.Count, "M").End(xlUp).Row

Set rng = Sheets("Sheet3").Range("M2:M" & lr3)


lr1 = Sheets("Sheet1").Cells(Rows.Count, "M").End(xlUp).Row

For r = lr1 To 2 Step -1

str = Sheets("Sheet1").Cells(r, "M")

If Application.WorksheetFunction.CountIf(rng, str) > 0 Then

Sheets("Sheet1").Range(Cells(r, "A"), Cells(r, "N")).Cut Sheets("Sheet2").Cells(i, "A")
Sheets("Sheet1").Range(Cells(r, "A"), Cells(r, "N")).Delete (xlShiftUp)
i = i + 1
End If
Next r

Application.ScreenUpdating = True

End Sub


Appreciate your help! Thanks in advance!










share|improve this question


















  • 1




    Bit hard to tell without seeing your data. Have you stepped through your code to see what's going on? You should add sheet references to all instances of Cells.
    – SJR
    Nov 12 '18 at 19:07










  • If you're using Cut, why do you need a Delete line?
    – dwirony
    Nov 12 '18 at 19:08










  • @dwirony cut doesn't remove the line, it leaves an empty area
    – Kubie
    Nov 12 '18 at 19:10












  • @Kubie perhaps dwirony was implying keep the delete and drop the cut...
    – Solar Mike
    Nov 12 '18 at 19:14










  • @SolarMike good point, in that case can change the cut to a range.value = range.value
    – Kubie
    Nov 12 '18 at 19:16














0












0








0







I am trying a code here to match all the cells of the "M" column in Sheet1 and Sheet3, and copy and delete all the rows from Sheet1 that contain any value from Sheet3's "M" column. Also, I want the records to get copied into "Sheet2" (all records to be deleted) However, it is deleting all the records but copying only the first row and not all the required rows. I tried some solutions I found online, but with no luck. Could anyone please suggest what might be the problem.



Below is the code:



Sub DeleteRows()

Dim rng As Range
Dim r As Long
Dim lr1 As Long
Dim lr3 As Long
Dim str As Variant
Dim i As Long: i = 1

Application.ScreenUpdating = False


lr3 = Sheets("Sheet3").Cells(Rows.Count, "M").End(xlUp).Row

Set rng = Sheets("Sheet3").Range("M2:M" & lr3)


lr1 = Sheets("Sheet1").Cells(Rows.Count, "M").End(xlUp).Row

For r = lr1 To 2 Step -1

str = Sheets("Sheet1").Cells(r, "M")

If Application.WorksheetFunction.CountIf(rng, str) > 0 Then

Sheets("Sheet1").Range(Cells(r, "A"), Cells(r, "N")).Cut Sheets("Sheet2").Cells(i, "A")
Sheets("Sheet1").Range(Cells(r, "A"), Cells(r, "N")).Delete (xlShiftUp)
i = i + 1
End If
Next r

Application.ScreenUpdating = True

End Sub


Appreciate your help! Thanks in advance!










share|improve this question













I am trying a code here to match all the cells of the "M" column in Sheet1 and Sheet3, and copy and delete all the rows from Sheet1 that contain any value from Sheet3's "M" column. Also, I want the records to get copied into "Sheet2" (all records to be deleted) However, it is deleting all the records but copying only the first row and not all the required rows. I tried some solutions I found online, but with no luck. Could anyone please suggest what might be the problem.



Below is the code:



Sub DeleteRows()

Dim rng As Range
Dim r As Long
Dim lr1 As Long
Dim lr3 As Long
Dim str As Variant
Dim i As Long: i = 1

Application.ScreenUpdating = False


lr3 = Sheets("Sheet3").Cells(Rows.Count, "M").End(xlUp).Row

Set rng = Sheets("Sheet3").Range("M2:M" & lr3)


lr1 = Sheets("Sheet1").Cells(Rows.Count, "M").End(xlUp).Row

For r = lr1 To 2 Step -1

str = Sheets("Sheet1").Cells(r, "M")

If Application.WorksheetFunction.CountIf(rng, str) > 0 Then

Sheets("Sheet1").Range(Cells(r, "A"), Cells(r, "N")).Cut Sheets("Sheet2").Cells(i, "A")
Sheets("Sheet1").Range(Cells(r, "A"), Cells(r, "N")).Delete (xlShiftUp)
i = i + 1
End If
Next r

Application.ScreenUpdating = True

End Sub


Appreciate your help! Thanks in advance!







excel vba excel-vba






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 12 '18 at 19:02









SiddharthSiddharth

284




284








  • 1




    Bit hard to tell without seeing your data. Have you stepped through your code to see what's going on? You should add sheet references to all instances of Cells.
    – SJR
    Nov 12 '18 at 19:07










  • If you're using Cut, why do you need a Delete line?
    – dwirony
    Nov 12 '18 at 19:08










  • @dwirony cut doesn't remove the line, it leaves an empty area
    – Kubie
    Nov 12 '18 at 19:10












  • @Kubie perhaps dwirony was implying keep the delete and drop the cut...
    – Solar Mike
    Nov 12 '18 at 19:14










  • @SolarMike good point, in that case can change the cut to a range.value = range.value
    – Kubie
    Nov 12 '18 at 19:16














  • 1




    Bit hard to tell without seeing your data. Have you stepped through your code to see what's going on? You should add sheet references to all instances of Cells.
    – SJR
    Nov 12 '18 at 19:07










  • If you're using Cut, why do you need a Delete line?
    – dwirony
    Nov 12 '18 at 19:08










  • @dwirony cut doesn't remove the line, it leaves an empty area
    – Kubie
    Nov 12 '18 at 19:10












  • @Kubie perhaps dwirony was implying keep the delete and drop the cut...
    – Solar Mike
    Nov 12 '18 at 19:14










  • @SolarMike good point, in that case can change the cut to a range.value = range.value
    – Kubie
    Nov 12 '18 at 19:16








1




1




Bit hard to tell without seeing your data. Have you stepped through your code to see what's going on? You should add sheet references to all instances of Cells.
– SJR
Nov 12 '18 at 19:07




Bit hard to tell without seeing your data. Have you stepped through your code to see what's going on? You should add sheet references to all instances of Cells.
– SJR
Nov 12 '18 at 19:07












If you're using Cut, why do you need a Delete line?
– dwirony
Nov 12 '18 at 19:08




If you're using Cut, why do you need a Delete line?
– dwirony
Nov 12 '18 at 19:08












@dwirony cut doesn't remove the line, it leaves an empty area
– Kubie
Nov 12 '18 at 19:10






@dwirony cut doesn't remove the line, it leaves an empty area
– Kubie
Nov 12 '18 at 19:10














@Kubie perhaps dwirony was implying keep the delete and drop the cut...
– Solar Mike
Nov 12 '18 at 19:14




@Kubie perhaps dwirony was implying keep the delete and drop the cut...
– Solar Mike
Nov 12 '18 at 19:14












@SolarMike good point, in that case can change the cut to a range.value = range.value
– Kubie
Nov 12 '18 at 19:16




@SolarMike good point, in that case can change the cut to a range.value = range.value
– Kubie
Nov 12 '18 at 19:16












1 Answer
1






active

oldest

votes


















1














Well here's your almost exact same code just added With blocks and .'s because that might've been the problem



Sub DeleteRows()

Dim rng As Range
Dim r As Long
Dim lr1 As Long
Dim lr3 As Long
Dim str As Variant
Dim i As Long: i = 1

Application.ScreenUpdating = False
With ThisWorkbook.Worksheets("Sheet3")
lr3 = .Cells(.Rows.Count, "M").End(xlUp).Row
Set rng = .Range("M2:M" & lr3)
End With

With ThisWorkbook.Worksheets("Sheet1")
lr1 = .Cells(.Rows.Count, "M").End(xlUp).Row
For r = lr1 To 2 Step -1
str = .Cells(r, "M").Value
If Application.WorksheetFunction.CountIf(rng, str) > 0 Then
Sheets("Sheet2").Range(Sheets("Sheet2").Cells(i, "A"), Sheets("Sheet2").Cells(i, "N")).Value = _
.Range(.Cells(r, "A"), .Cells(r, "N")).Value
.Range(.Cells(r, "A"), .Cells(r, "N")).Delete (xlShiftUp)
i = i + 1
End If
Next r
End With

Application.ScreenUpdating = True
End Sub





share|improve this answer























  • Yes, that's the way to go, but the lack of dots would have caused an error if that were the problem so there must be something else.
    – SJR
    Nov 12 '18 at 19:36










  • @SJR maybe there was a logical error with getting the last rows or something along those lines?
    – Kubie
    Nov 12 '18 at 19:39










  • Maybe so, think we're all rather in the dark until the OP clarifies.
    – SJR
    Nov 12 '18 at 19:44










  • Hello @Kubie Thank you for your help! The code is working fine, I can see multiple rows getting copied. But, the sheet "Sheet2" is getting overwritten every time. I want it to get appended with the new data. I tried adding an Offset, but that copied a single row. Any inputs?
    – Siddharth
    Nov 12 '18 at 21:28






  • 1




    @Siddharth use the find lastrow function for i that u also use for lr1
    – Kubie
    Nov 12 '18 at 23:00











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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53268511%2fvba-cut-paste-copies-only-one-row-and-not-all-the-rows%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Well here's your almost exact same code just added With blocks and .'s because that might've been the problem



Sub DeleteRows()

Dim rng As Range
Dim r As Long
Dim lr1 As Long
Dim lr3 As Long
Dim str As Variant
Dim i As Long: i = 1

Application.ScreenUpdating = False
With ThisWorkbook.Worksheets("Sheet3")
lr3 = .Cells(.Rows.Count, "M").End(xlUp).Row
Set rng = .Range("M2:M" & lr3)
End With

With ThisWorkbook.Worksheets("Sheet1")
lr1 = .Cells(.Rows.Count, "M").End(xlUp).Row
For r = lr1 To 2 Step -1
str = .Cells(r, "M").Value
If Application.WorksheetFunction.CountIf(rng, str) > 0 Then
Sheets("Sheet2").Range(Sheets("Sheet2").Cells(i, "A"), Sheets("Sheet2").Cells(i, "N")).Value = _
.Range(.Cells(r, "A"), .Cells(r, "N")).Value
.Range(.Cells(r, "A"), .Cells(r, "N")).Delete (xlShiftUp)
i = i + 1
End If
Next r
End With

Application.ScreenUpdating = True
End Sub





share|improve this answer























  • Yes, that's the way to go, but the lack of dots would have caused an error if that were the problem so there must be something else.
    – SJR
    Nov 12 '18 at 19:36










  • @SJR maybe there was a logical error with getting the last rows or something along those lines?
    – Kubie
    Nov 12 '18 at 19:39










  • Maybe so, think we're all rather in the dark until the OP clarifies.
    – SJR
    Nov 12 '18 at 19:44










  • Hello @Kubie Thank you for your help! The code is working fine, I can see multiple rows getting copied. But, the sheet "Sheet2" is getting overwritten every time. I want it to get appended with the new data. I tried adding an Offset, but that copied a single row. Any inputs?
    – Siddharth
    Nov 12 '18 at 21:28






  • 1




    @Siddharth use the find lastrow function for i that u also use for lr1
    – Kubie
    Nov 12 '18 at 23:00
















1














Well here's your almost exact same code just added With blocks and .'s because that might've been the problem



Sub DeleteRows()

Dim rng As Range
Dim r As Long
Dim lr1 As Long
Dim lr3 As Long
Dim str As Variant
Dim i As Long: i = 1

Application.ScreenUpdating = False
With ThisWorkbook.Worksheets("Sheet3")
lr3 = .Cells(.Rows.Count, "M").End(xlUp).Row
Set rng = .Range("M2:M" & lr3)
End With

With ThisWorkbook.Worksheets("Sheet1")
lr1 = .Cells(.Rows.Count, "M").End(xlUp).Row
For r = lr1 To 2 Step -1
str = .Cells(r, "M").Value
If Application.WorksheetFunction.CountIf(rng, str) > 0 Then
Sheets("Sheet2").Range(Sheets("Sheet2").Cells(i, "A"), Sheets("Sheet2").Cells(i, "N")).Value = _
.Range(.Cells(r, "A"), .Cells(r, "N")).Value
.Range(.Cells(r, "A"), .Cells(r, "N")).Delete (xlShiftUp)
i = i + 1
End If
Next r
End With

Application.ScreenUpdating = True
End Sub





share|improve this answer























  • Yes, that's the way to go, but the lack of dots would have caused an error if that were the problem so there must be something else.
    – SJR
    Nov 12 '18 at 19:36










  • @SJR maybe there was a logical error with getting the last rows or something along those lines?
    – Kubie
    Nov 12 '18 at 19:39










  • Maybe so, think we're all rather in the dark until the OP clarifies.
    – SJR
    Nov 12 '18 at 19:44










  • Hello @Kubie Thank you for your help! The code is working fine, I can see multiple rows getting copied. But, the sheet "Sheet2" is getting overwritten every time. I want it to get appended with the new data. I tried adding an Offset, but that copied a single row. Any inputs?
    – Siddharth
    Nov 12 '18 at 21:28






  • 1




    @Siddharth use the find lastrow function for i that u also use for lr1
    – Kubie
    Nov 12 '18 at 23:00














1












1








1






Well here's your almost exact same code just added With blocks and .'s because that might've been the problem



Sub DeleteRows()

Dim rng As Range
Dim r As Long
Dim lr1 As Long
Dim lr3 As Long
Dim str As Variant
Dim i As Long: i = 1

Application.ScreenUpdating = False
With ThisWorkbook.Worksheets("Sheet3")
lr3 = .Cells(.Rows.Count, "M").End(xlUp).Row
Set rng = .Range("M2:M" & lr3)
End With

With ThisWorkbook.Worksheets("Sheet1")
lr1 = .Cells(.Rows.Count, "M").End(xlUp).Row
For r = lr1 To 2 Step -1
str = .Cells(r, "M").Value
If Application.WorksheetFunction.CountIf(rng, str) > 0 Then
Sheets("Sheet2").Range(Sheets("Sheet2").Cells(i, "A"), Sheets("Sheet2").Cells(i, "N")).Value = _
.Range(.Cells(r, "A"), .Cells(r, "N")).Value
.Range(.Cells(r, "A"), .Cells(r, "N")).Delete (xlShiftUp)
i = i + 1
End If
Next r
End With

Application.ScreenUpdating = True
End Sub





share|improve this answer














Well here's your almost exact same code just added With blocks and .'s because that might've been the problem



Sub DeleteRows()

Dim rng As Range
Dim r As Long
Dim lr1 As Long
Dim lr3 As Long
Dim str As Variant
Dim i As Long: i = 1

Application.ScreenUpdating = False
With ThisWorkbook.Worksheets("Sheet3")
lr3 = .Cells(.Rows.Count, "M").End(xlUp).Row
Set rng = .Range("M2:M" & lr3)
End With

With ThisWorkbook.Worksheets("Sheet1")
lr1 = .Cells(.Rows.Count, "M").End(xlUp).Row
For r = lr1 To 2 Step -1
str = .Cells(r, "M").Value
If Application.WorksheetFunction.CountIf(rng, str) > 0 Then
Sheets("Sheet2").Range(Sheets("Sheet2").Cells(i, "A"), Sheets("Sheet2").Cells(i, "N")).Value = _
.Range(.Cells(r, "A"), .Cells(r, "N")).Value
.Range(.Cells(r, "A"), .Cells(r, "N")).Delete (xlShiftUp)
i = i + 1
End If
Next r
End With

Application.ScreenUpdating = True
End Sub






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 12 '18 at 21:31

























answered Nov 12 '18 at 19:21









KubieKubie

1,194418




1,194418












  • Yes, that's the way to go, but the lack of dots would have caused an error if that were the problem so there must be something else.
    – SJR
    Nov 12 '18 at 19:36










  • @SJR maybe there was a logical error with getting the last rows or something along those lines?
    – Kubie
    Nov 12 '18 at 19:39










  • Maybe so, think we're all rather in the dark until the OP clarifies.
    – SJR
    Nov 12 '18 at 19:44










  • Hello @Kubie Thank you for your help! The code is working fine, I can see multiple rows getting copied. But, the sheet "Sheet2" is getting overwritten every time. I want it to get appended with the new data. I tried adding an Offset, but that copied a single row. Any inputs?
    – Siddharth
    Nov 12 '18 at 21:28






  • 1




    @Siddharth use the find lastrow function for i that u also use for lr1
    – Kubie
    Nov 12 '18 at 23:00


















  • Yes, that's the way to go, but the lack of dots would have caused an error if that were the problem so there must be something else.
    – SJR
    Nov 12 '18 at 19:36










  • @SJR maybe there was a logical error with getting the last rows or something along those lines?
    – Kubie
    Nov 12 '18 at 19:39










  • Maybe so, think we're all rather in the dark until the OP clarifies.
    – SJR
    Nov 12 '18 at 19:44










  • Hello @Kubie Thank you for your help! The code is working fine, I can see multiple rows getting copied. But, the sheet "Sheet2" is getting overwritten every time. I want it to get appended with the new data. I tried adding an Offset, but that copied a single row. Any inputs?
    – Siddharth
    Nov 12 '18 at 21:28






  • 1




    @Siddharth use the find lastrow function for i that u also use for lr1
    – Kubie
    Nov 12 '18 at 23:00
















Yes, that's the way to go, but the lack of dots would have caused an error if that were the problem so there must be something else.
– SJR
Nov 12 '18 at 19:36




Yes, that's the way to go, but the lack of dots would have caused an error if that were the problem so there must be something else.
– SJR
Nov 12 '18 at 19:36












@SJR maybe there was a logical error with getting the last rows or something along those lines?
– Kubie
Nov 12 '18 at 19:39




@SJR maybe there was a logical error with getting the last rows or something along those lines?
– Kubie
Nov 12 '18 at 19:39












Maybe so, think we're all rather in the dark until the OP clarifies.
– SJR
Nov 12 '18 at 19:44




Maybe so, think we're all rather in the dark until the OP clarifies.
– SJR
Nov 12 '18 at 19:44












Hello @Kubie Thank you for your help! The code is working fine, I can see multiple rows getting copied. But, the sheet "Sheet2" is getting overwritten every time. I want it to get appended with the new data. I tried adding an Offset, but that copied a single row. Any inputs?
– Siddharth
Nov 12 '18 at 21:28




Hello @Kubie Thank you for your help! The code is working fine, I can see multiple rows getting copied. But, the sheet "Sheet2" is getting overwritten every time. I want it to get appended with the new data. I tried adding an Offset, but that copied a single row. Any inputs?
– Siddharth
Nov 12 '18 at 21:28




1




1




@Siddharth use the find lastrow function for i that u also use for lr1
– Kubie
Nov 12 '18 at 23:00




@Siddharth use the find lastrow function for i that u also use for lr1
– Kubie
Nov 12 '18 at 23:00


















draft saved

draft discarded




















































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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53268511%2fvba-cut-paste-copies-only-one-row-and-not-all-the-rows%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Florida Star v. B. J. F.

Danny Elfman

Lugert, Oklahoma