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

I want to create a code to put into a macro that does this:

IF the value in column I is less than 7 Then Delete the cells within that
row from Column E to Column J and shift the rows to the right over into their
place.

Kinda wierd, I know. Don't ask :) Am I way off to try an If statement,
or should I go a different route? THANKS!!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default If Statement


Try this:


If Selection.Value < 7 Then
Range("E" & Selection.Row & ":" & "J" & Selection.Row).Select
Selection.Delete Shift:=xlToLeft
End If


--
Bearacade


------------------------------------------------------------------------
Bearacade's Profile: http://www.excelforum.com/member.php...o&userid=35016
View this thread: http://www.excelforum.com/showthread...hreadid=552003

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default If Statement

sub DeleteStuff()

Dim lastrow as Long, i as Long
Dim cell as Range

lastrow = cells(rows.count,"I").end(xlup).row
fori = 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:=xlShiftLeft
end if
end if
Next
end sub

--
Regards,
Tom Ogilvy

"bodhisatvaofboogie" wrote:

I want to create a code to put into a macro that does this:

IF the value in column I is less than 7 Then Delete the cells within that
row from Column E to Column J and shift the rows to the right over into their
place.

Kinda wierd, I know. Don't ask :) Am I way off to try an If statement,
or should I go a different route? THANKS!!!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default OT


"bodhisatvaofboogie"

a Steely Dan fan?


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
IF statement inside a SUMIF statement.... or alternative method Sungibungi Excel Worksheet Functions 3 December 4th 09 06:22 PM
Reconcile Bank statement & Credit card statement & accounting data Bklynhyc Excel Worksheet Functions 0 October 7th 09 09:07 PM
Embedding an OR statement in an IF statement efficiently Chatnoir11 Excel Discussion (Misc queries) 4 February 2nd 09 08:12 PM
Sum if statement with a left statement Eric D Excel Discussion (Misc queries) 4 July 23rd 08 05:31 PM
appending and IF statement to an existing IF statement spence Excel Worksheet Functions 1 February 28th 06 11:00 PM


All times are GMT +1. The time now is 04:24 PM.

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"