Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Cell Deleting and Shifting

Dim lastrow As Long, i As Long
Dim cell As Range

lastrow = Cells(Rows.Count, "I").End(xlUp).Row
For i = lastrow To 1 Step -1
Set cell = Cells(i, "I")
If IsNumeric(cell) Then
If cell < 7 Then
cell.Offset(0, -4).Resize(1, 6).Delete
End If
End If
Next

This formula works great, THOUGH I want it to do something a little
different. It deletes the appropriate cells, however I want it to shift the
information in the cells to the right of the deleted cells over into their
place(so shift to left). Right now it deletes everything then shifts it up.
So where do I make the change? THANKS!!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Cell Deleting and Shifting

lastrow = Cells(Rows.Count, "I").End(xlUp).Row
For i = lastrow To 1 Step -1
Set cell = Cells(i, "I")
If IsNumeric(cell) Then
If cell < 7 Then
cell.Offset(0, -4).Resize(1, 6).Delete shift:=xlToLeft
End If
End If
Next

HTH

Die_Another_Day

P.S. Have you ever tried using the macro recorder to figure these
things out?

bodhisatvaofboogie wrote:
Dim lastrow As Long, i As Long
Dim cell As Range

lastrow = Cells(Rows.Count, "I").End(xlUp).Row
For i = lastrow To 1 Step -1
Set cell = Cells(i, "I")
If IsNumeric(cell) Then
If cell < 7 Then
cell.Offset(0, -4).Resize(1, 6).Delete
End If
End If
Next

This formula works great, THOUGH I want it to do something a little
different. It deletes the appropriate cells, however I want it to shift the
information in the cells to the right of the deleted cells over into their
place(so shift to left). Right now it deletes everything then shifts it up.
So where do I make the change? THANKS!!!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Cell Deleting and Shifting

That works great, NOW: I use this formula a couple times, when it gets to
the last row of data, I want it to do the deletion without shifting the rows
up, what do I have to put in to avoid that? Without the shift part, it
simply delets then shifts all remaining rows up, and I don't want that.
Thanks!!!!

"Die_Another_Day" wrote:

lastrow = Cells(Rows.Count, "I").End(xlUp).Row
For i = lastrow To 1 Step -1
Set cell = Cells(i, "I")
If IsNumeric(cell) Then
If cell < 7 Then
cell.Offset(0, -4).Resize(1, 6).Delete shift:=xlToLeft
End If
End If
Next

HTH

Die_Another_Day

P.S. Have you ever tried using the macro recorder to figure these
things out?

bodhisatvaofboogie wrote:
Dim lastrow As Long, i As Long
Dim cell As Range

lastrow = Cells(Rows.Count, "I").End(xlUp).Row
For i = lastrow To 1 Step -1
Set cell = Cells(i, "I")
If IsNumeric(cell) Then
If cell < 7 Then
cell.Offset(0, -4).Resize(1, 6).Delete
End If
End If
Next

This formula works great, THOUGH I want it to do something a little
different. It deletes the appropriate cells, however I want it to shift the
information in the cells to the right of the deleted cells over into their
place(so shift to left). Right now it deletes everything then shifts it up.
So where do I make the change? THANKS!!!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Cell Deleting and Shifting

if all you are wanting to do is clear the data then use .ClearContents
instead of .Delete otherwise I don't quite understand what you are
wanting can you elaborate please?

HTH

Die_Another_Day

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting Rows and Shifting Up - Repost D.Parker Excel Discussion (Misc queries) 14 October 11th 07 04:58 AM
Deleting and shifting cells and columns Curt1521 Excel Worksheet Functions 7 May 8th 06 04:14 PM
Deleting cells and shifting "right" CDWhite Excel Discussion (Misc queries) 5 April 15th 06 02:50 AM
Auto Update upon shifting, inserting or deleting Tracy B Excel Worksheet Functions 2 April 6th 05 08:37 PM
Deleting blanks and shifting left - cont. jrb[_4_] Excel Programming 3 February 27th 04 02:23 AM


All times are GMT +1. The time now is 07:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"