Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to modify my code to search from the last row, at the moment it only
goes from the last row there is data in for my specific column(DT), can I make it start from the last row where there is data from column A but only searching the column i need(DT) Dim rng As Range Dim i As Long Set rng = ActiveSheet.Range(Cells(1, "DT"), Cells(Rows.Count, "DT").End(xlUp)) With rng For i = .Rows.Count To 1 Step -1 If InStr(UCase(.Cells(i)), UCase(UserForm7.TextBox2.Text)) = 0 Then .Cells(i).EntireRow.Delete End If Next i End With Thank you in advance |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim lngTemp, lngRow
lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row For lngTemp = lngRow To 1 Step -1 If InStr(Range("DT" & lngTemp), UCase(UserForm7.TextBox2.Text)) = 0 Then Activesheet.Cells(lngTemp).EntireRow.Delete End If Next lngTemp If this post helps click Yes --------------- Jacob Skaria "Miree" wrote: I need to modify my code to search from the last row, at the moment it only goes from the last row there is data in for my specific column(DT), can I make it start from the last row where there is data from column A but only searching the column i need(DT) Dim rng As Range Dim i As Long Set rng = ActiveSheet.Range(Cells(1, "DT"), Cells(Rows.Count, "DT").End(xlUp)) With rng For i = .Rows.Count To 1 Step -1 If InStr(UCase(.Cells(i)), UCase(UserForm7.TextBox2.Text)) = 0 Then .Cells(i).EntireRow.Delete End If Next i End With Thank you in advance |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
sorry this didnt work, what i think might be eaisier(for my simple midnd) is
if you could help me with a code to identify and select the row one down from the last data point in column A "Jacob Skaria" wrote: Dim lngTemp, lngRow lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row For lngTemp = lngRow To 1 Step -1 If InStr(Range("DT" & lngTemp), UCase(UserForm7.TextBox2.Text)) = 0 Then Activesheet.Cells(lngTemp).EntireRow.Delete End If Next lngTemp If this post helps click Yes --------------- Jacob Skaria "Miree" wrote: I need to modify my code to search from the last row, at the moment it only goes from the last row there is data in for my specific column(DT), can I make it start from the last row where there is data from column A but only searching the column i need(DT) Dim rng As Range Dim i As Long Set rng = ActiveSheet.Range(Cells(1, "DT"), Cells(Rows.Count, "DT").End(xlUp)) With rng For i = .Rows.Count To 1 Step -1 If InStr(UCase(.Cells(i)), UCase(UserForm7.TextBox2.Text)) = 0 Then .Cells(i).EntireRow.Delete End If Next i End With Thank you in advance |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jacob gave you that (well, except for the "one down from" part). Jacob
posted this... lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row which is the row containing the last piece of data in Column A. Since you want one down from this, just add one to it... RowAfterLastDataInA = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1 -- Rick (MVP - Excel) "Miree" wrote in message ... sorry this didnt work, what i think might be eaisier(for my simple midnd) is if you could help me with a code to identify and select the row one down from the last data point in column A "Jacob Skaria" wrote: Dim lngTemp, lngRow lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row For lngTemp = lngRow To 1 Step -1 If InStr(Range("DT" & lngTemp), UCase(UserForm7.TextBox2.Text)) = 0 Then Activesheet.Cells(lngTemp).EntireRow.Delete End If Next lngTemp If this post helps click Yes --------------- Jacob Skaria "Miree" wrote: I need to modify my code to search from the last row, at the moment it only goes from the last row there is data in for my specific column(DT), can I make it start from the last row where there is data from column A but only searching the column i need(DT) Dim rng As Range Dim i As Long Set rng = ActiveSheet.Range(Cells(1, "DT"), Cells(Rows.Count, "DT").End(xlUp)) With rng For i = .Rows.Count To 1 Step -1 If InStr(UCase(.Cells(i)), UCase(UserForm7.TextBox2.Text)) = 0 Then .Cells(i).EntireRow.Delete End If Next i End With Thank you in advance |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Im sorry all this coding is new to me, I am trying to learn as I go, and
because of this I dont understand some basics. Most of what I get is copied and paste from else where, i dont understand what it does but know it does what i need it to. What I am trying to do is select the last row + 1 and then apply this to it Cells.Select Selection.SpecialCells(xlCellTypeBlanks).Select Selection.FormulaR1C1 = ".." although this line finds the row i need, how can i get it to select it? RowAfterLastDataInA = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1 "Rick Rothstein" wrote: Jacob gave you that (well, except for the "one down from" part). Jacob posted this... lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row which is the row containing the last piece of data in Column A. Since you want one down from this, just add one to it... RowAfterLastDataInA = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1 -- Rick (MVP - Excel) "Miree" wrote in message ... sorry this didnt work, what i think might be eaisier(for my simple midnd) is if you could help me with a code to identify and select the row one down from the last data point in column A "Jacob Skaria" wrote: Dim lngTemp, lngRow lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row For lngTemp = lngRow To 1 Step -1 If InStr(Range("DT" & lngTemp), UCase(UserForm7.TextBox2.Text)) = 0 Then Activesheet.Cells(lngTemp).EntireRow.Delete End If Next lngTemp If this post helps click Yes --------------- Jacob Skaria "Miree" wrote: I need to modify my code to search from the last row, at the moment it only goes from the last row there is data in for my specific column(DT), can I make it start from the last row where there is data from column A but only searching the column i need(DT) Dim rng As Range Dim i As Long Set rng = ActiveSheet.Range(Cells(1, "DT"), Cells(Rows.Count, "DT").End(xlUp)) With rng For i = .Rows.Count To 1 Step -1 If InStr(UCase(.Cells(i)), UCase(UserForm7.TextBox2.Text)) = 0 Then .Cells(i).EntireRow.Delete End If Next i End With Thank you in advance |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Will give you an example
If I want to select Range(A1:A12) mention that as Range("A1:A" & variable).Select If this post helps click Yes --------------- Jacob Skaria "Miree" wrote: Im sorry all this coding is new to me, I am trying to learn as I go, and because of this I dont understand some basics. Most of what I get is copied and paste from else where, i dont understand what it does but know it does what i need it to. What I am trying to do is select the last row + 1 and then apply this to it Cells.Select Selection.SpecialCells(xlCellTypeBlanks).Select Selection.FormulaR1C1 = ".." although this line finds the row i need, how can i get it to select it? RowAfterLastDataInA = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1 "Rick Rothstein" wrote: Jacob gave you that (well, except for the "one down from" part). Jacob posted this... lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row which is the row containing the last piece of data in Column A. Since you want one down from this, just add one to it... RowAfterLastDataInA = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1 -- Rick (MVP - Excel) "Miree" wrote in message ... sorry this didnt work, what i think might be eaisier(for my simple midnd) is if you could help me with a code to identify and select the row one down from the last data point in column A "Jacob Skaria" wrote: Dim lngTemp, lngRow lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row For lngTemp = lngRow To 1 Step -1 If InStr(Range("DT" & lngTemp), UCase(UserForm7.TextBox2.Text)) = 0 Then Activesheet.Cells(lngTemp).EntireRow.Delete End If Next lngTemp If this post helps click Yes --------------- Jacob Skaria "Miree" wrote: I need to modify my code to search from the last row, at the moment it only goes from the last row there is data in for my specific column(DT), can I make it start from the last row where there is data from column A but only searching the column i need(DT) Dim rng As Range Dim i As Long Set rng = ActiveSheet.Range(Cells(1, "DT"), Cells(Rows.Count, "DT").End(xlUp)) With rng For i = .Rows.Count To 1 Step -1 If InStr(UCase(.Cells(i)), UCase(UserForm7.TextBox2.Text)) = 0 Then .Cells(i).EntireRow.Delete End If Next i End With Thank you in advance |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Rick
Dear Miree..Sorry, you have not mentioned about Selection.FormulaR1C1 = ".." in your initial post. The code which we have posted will satisfy the requirement mentioned "Search up from last row".. If this post helps click Yes --------------- Jacob Skaria "Miree" wrote: Im sorry all this coding is new to me, I am trying to learn as I go, and because of this I dont understand some basics. Most of what I get is copied and paste from else where, i dont understand what it does but know it does what i need it to. What I am trying to do is select the last row + 1 and then apply this to it Cells.Select Selection.SpecialCells(xlCellTypeBlanks).Select Selection.FormulaR1C1 = ".." although this line finds the row i need, how can i get it to select it? RowAfterLastDataInA = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1 "Rick Rothstein" wrote: Jacob gave you that (well, except for the "one down from" part). Jacob posted this... lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row which is the row containing the last piece of data in Column A. Since you want one down from this, just add one to it... RowAfterLastDataInA = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1 -- Rick (MVP - Excel) "Miree" wrote in message ... sorry this didnt work, what i think might be eaisier(for my simple midnd) is if you could help me with a code to identify and select the row one down from the last data point in column A "Jacob Skaria" wrote: Dim lngTemp, lngRow lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row For lngTemp = lngRow To 1 Step -1 If InStr(Range("DT" & lngTemp), UCase(UserForm7.TextBox2.Text)) = 0 Then Activesheet.Cells(lngTemp).EntireRow.Delete End If Next lngTemp If this post helps click Yes --------------- Jacob Skaria "Miree" wrote: I need to modify my code to search from the last row, at the moment it only goes from the last row there is data in for my specific column(DT), can I make it start from the last row where there is data from column A but only searching the column i need(DT) Dim rng As Range Dim i As Long Set rng = ActiveSheet.Range(Cells(1, "DT"), Cells(Rows.Count, "DT").End(xlUp)) With rng For i = .Rows.Count To 1 Step -1 If InStr(UCase(.Cells(i)), UCase(UserForm7.TextBox2.Text)) = 0 Then .Cells(i).EntireRow.Delete End If Next i End With Thank you in advance |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I understand that but what i dont understand it is if i dont know what range
i want to select how do i tell it to select the last row(in A) +1 "Jacob Skaria" wrote: Will give you an example If I want to select Range(A1:A12) mention that as Range("A1:A" & variable).Select If this post helps click Yes --------------- Jacob Skaria "Miree" wrote: Im sorry all this coding is new to me, I am trying to learn as I go, and because of this I dont understand some basics. Most of what I get is copied and paste from else where, i dont understand what it does but know it does what i need it to. What I am trying to do is select the last row + 1 and then apply this to it Cells.Select Selection.SpecialCells(xlCellTypeBlanks).Select Selection.FormulaR1C1 = ".." although this line finds the row i need, how can i get it to select it? RowAfterLastDataInA = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1 "Rick Rothstein" wrote: Jacob gave you that (well, except for the "one down from" part). Jacob posted this... lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row which is the row containing the last piece of data in Column A. Since you want one down from this, just add one to it... RowAfterLastDataInA = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1 -- Rick (MVP - Excel) "Miree" wrote in message ... sorry this didnt work, what i think might be eaisier(for my simple midnd) is if you could help me with a code to identify and select the row one down from the last data point in column A "Jacob Skaria" wrote: Dim lngTemp, lngRow lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row For lngTemp = lngRow To 1 Step -1 If InStr(Range("DT" & lngTemp), UCase(UserForm7.TextBox2.Text)) = 0 Then Activesheet.Cells(lngTemp).EntireRow.Delete End If Next lngTemp If this post helps click Yes --------------- Jacob Skaria "Miree" wrote: I need to modify my code to search from the last row, at the moment it only goes from the last row there is data in for my specific column(DT), can I make it start from the last row where there is data from column A but only searching the column i need(DT) Dim rng As Range Dim i As Long Set rng = ActiveSheet.Range(Cells(1, "DT"), Cells(Rows.Count, "DT").End(xlUp)) With rng For i = .Rows.Count To 1 Step -1 If InStr(UCase(.Cells(i)), UCase(UserForm7.TextBox2.Text)) = 0 Then .Cells(i).EntireRow.Delete End If Next i End With Thank you in advance |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Please try this
lngLastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row Range("A1:A" & lngLastRow +1).Select If this post helps click Yes --------------- Jacob Skaria "Miree" wrote: I understand that but what i dont understand it is if i dont know what range i want to select how do i tell it to select the last row(in A) +1 "Jacob Skaria" wrote: Will give you an example If I want to select Range(A1:A12) mention that as Range("A1:A" & variable).Select If this post helps click Yes --------------- Jacob Skaria "Miree" wrote: Im sorry all this coding is new to me, I am trying to learn as I go, and because of this I dont understand some basics. Most of what I get is copied and paste from else where, i dont understand what it does but know it does what i need it to. What I am trying to do is select the last row + 1 and then apply this to it Cells.Select Selection.SpecialCells(xlCellTypeBlanks).Select Selection.FormulaR1C1 = ".." although this line finds the row i need, how can i get it to select it? RowAfterLastDataInA = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1 "Rick Rothstein" wrote: Jacob gave you that (well, except for the "one down from" part). Jacob posted this... lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row which is the row containing the last piece of data in Column A. Since you want one down from this, just add one to it... RowAfterLastDataInA = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1 -- Rick (MVP - Excel) "Miree" wrote in message ... sorry this didnt work, what i think might be eaisier(for my simple midnd) is if you could help me with a code to identify and select the row one down from the last data point in column A "Jacob Skaria" wrote: Dim lngTemp, lngRow lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row For lngTemp = lngRow To 1 Step -1 If InStr(Range("DT" & lngTemp), UCase(UserForm7.TextBox2.Text)) = 0 Then Activesheet.Cells(lngTemp).EntireRow.Delete End If Next lngTemp If this post helps click Yes --------------- Jacob Skaria "Miree" wrote: I need to modify my code to search from the last row, at the moment it only goes from the last row there is data in for my specific column(DT), can I make it start from the last row where there is data from column A but only searching the column i need(DT) Dim rng As Range Dim i As Long Set rng = ActiveSheet.Range(Cells(1, "DT"), Cells(Rows.Count, "DT").End(xlUp)) With rng For i = .Rows.Count To 1 Step -1 If InStr(UCase(.Cells(i)), UCase(UserForm7.TextBox2.Text)) = 0 Then .Cells(i).EntireRow.Delete End If Next i End With Thank you in advance |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
had to modify slightly to just do last row, but works perfectly now, thank
you very super much to both of you. "Jacob Skaria" wrote: Thanks Rick Dear Miree..Sorry, you have not mentioned about Selection.FormulaR1C1 = ".." in your initial post. The code which we have posted will satisfy the requirement mentioned "Search up from last row".. If this post helps click Yes --------------- Jacob Skaria "Miree" wrote: Im sorry all this coding is new to me, I am trying to learn as I go, and because of this I dont understand some basics. Most of what I get is copied and paste from else where, i dont understand what it does but know it does what i need it to. What I am trying to do is select the last row + 1 and then apply this to it Cells.Select Selection.SpecialCells(xlCellTypeBlanks).Select Selection.FormulaR1C1 = ".." although this line finds the row i need, how can i get it to select it? RowAfterLastDataInA = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1 "Rick Rothstein" wrote: Jacob gave you that (well, except for the "one down from" part). Jacob posted this... lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row which is the row containing the last piece of data in Column A. Since you want one down from this, just add one to it... RowAfterLastDataInA = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1 -- Rick (MVP - Excel) "Miree" wrote in message ... sorry this didnt work, what i think might be eaisier(for my simple midnd) is if you could help me with a code to identify and select the row one down from the last data point in column A "Jacob Skaria" wrote: Dim lngTemp, lngRow lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row For lngTemp = lngRow To 1 Step -1 If InStr(Range("DT" & lngTemp), UCase(UserForm7.TextBox2.Text)) = 0 Then Activesheet.Cells(lngTemp).EntireRow.Delete End If Next lngTemp If this post helps click Yes --------------- Jacob Skaria "Miree" wrote: I need to modify my code to search from the last row, at the moment it only goes from the last row there is data in for my specific column(DT), can I make it start from the last row where there is data from column A but only searching the column i need(DT) Dim rng As Range Dim i As Long Set rng = ActiveSheet.Range(Cells(1, "DT"), Cells(Rows.Count, "DT").End(xlUp)) With rng For i = .Rows.Count To 1 Step -1 If InStr(UCase(.Cells(i)), UCase(UserForm7.TextBox2.Text)) = 0 Then .Cells(i).EntireRow.Delete End If Next i End With Thank you in advance |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not sure whether you have seen this post
lngLastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row Range("A1:A" & lngLastRow +1).Select If this post helps click Yes --------------- Jacob Skaria "Miree" wrote: had to modify slightly to just do last row, but works perfectly now, thank you very super much to both of you. "Jacob Skaria" wrote: Thanks Rick Dear Miree..Sorry, you have not mentioned about Selection.FormulaR1C1 = ".." in your initial post. The code which we have posted will satisfy the requirement mentioned "Search up from last row".. If this post helps click Yes --------------- Jacob Skaria "Miree" wrote: Im sorry all this coding is new to me, I am trying to learn as I go, and because of this I dont understand some basics. Most of what I get is copied and paste from else where, i dont understand what it does but know it does what i need it to. What I am trying to do is select the last row + 1 and then apply this to it Cells.Select Selection.SpecialCells(xlCellTypeBlanks).Select Selection.FormulaR1C1 = ".." although this line finds the row i need, how can i get it to select it? RowAfterLastDataInA = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1 "Rick Rothstein" wrote: Jacob gave you that (well, except for the "one down from" part). Jacob posted this... lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row which is the row containing the last piece of data in Column A. Since you want one down from this, just add one to it... RowAfterLastDataInA = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1 -- Rick (MVP - Excel) "Miree" wrote in message ... sorry this didnt work, what i think might be eaisier(for my simple midnd) is if you could help me with a code to identify and select the row one down from the last data point in column A "Jacob Skaria" wrote: Dim lngTemp, lngRow lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row For lngTemp = lngRow To 1 Step -1 If InStr(Range("DT" & lngTemp), UCase(UserForm7.TextBox2.Text)) = 0 Then Activesheet.Cells(lngTemp).EntireRow.Delete End If Next lngTemp If this post helps click Yes --------------- Jacob Skaria "Miree" wrote: I need to modify my code to search from the last row, at the moment it only goes from the last row there is data in for my specific column(DT), can I make it start from the last row where there is data from column A but only searching the column i need(DT) Dim rng As Range Dim i As Long Set rng = ActiveSheet.Range(Cells(1, "DT"), Cells(Rows.Count, "DT").End(xlUp)) With rng For i = .Rows.Count To 1 Step -1 If InStr(UCase(.Cells(i)), UCase(UserForm7.TextBox2.Text)) = 0 Then .Cells(i).EntireRow.Delete End If Next i End With Thank you in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Functions (search within search result) reply to this please | Excel Worksheet Functions | |||
Search lastname + firstname (search on uppercase) | Excel Programming | |||
How do I search excel spreadsheets using multiple search criteria. | Excel Worksheet Functions | |||
I cant do a search on this forum. Everytime I search, it comes up with zero results | Excel Programming | |||
Create a search Field within a worksheet to search command buttons | Excel Programming |