PC Review


Reply
Thread Tools Rate Thread

Search up from last row

 
 
Miree
Guest
Posts: n/a
 
      2nd Apr 2009
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 With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      2nd Apr 2009
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 With Quote
 
 
 
 
Miree
Guest
Posts: n/a
 
      2nd Apr 2009
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 With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      2nd Apr 2009
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 With Quote
 
Miree
Guest
Posts: n/a
 
      2nd Apr 2009
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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 With Quote
 
Jacob Skaria
Guest
Posts: n/a
 
      2nd Apr 2009
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" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > 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 With Quote
 
Jacob Skaria
Guest
Posts: n/a
 
      2nd Apr 2009
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" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > 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 With Quote
 
Miree
Guest
Posts: n/a
 
      2nd Apr 2009
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" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > 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 With Quote
 
Jacob Skaria
Guest
Posts: n/a
 
      2nd Apr 2009
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" <(E-Mail Removed)> wrote in message
> > > > news:(E-Mail Removed)...
> > > > > 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 With Quote
 
Miree
Guest
Posts: n/a
 
      2nd Apr 2009
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" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to find last row with Data, avg last 30, show result on row soccerdav2003 Microsoft Excel Programming 7 12th Jun 2008 05:40 PM
Copy last row from sheet 1 to last row in sheet 2 =?Utf-8?B?Q2FybGVl?= Microsoft Excel Programming 4 8th Jul 2007 02:39 AM
The best sub for last row / last column / last cell? =?Utf-8?B?anVzdG1l?= Microsoft Excel Programming 15 2nd Feb 2007 05:05 AM
Fill down to last row - copy formula to last row =?Utf-8?B?VGltVA==?= Microsoft Excel Programming 2 6th Oct 2006 04:50 PM
Locating the row that has no values. Selecting that row till the last row after that and deleting it? VB Script for Excel Microsoft Excel Programming 2 25th May 2006 01:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:42 PM.