Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Looping Macro to remove data where value is 0

I currently have a speadsheet which has been set up with
various heading across the page and reference numbers as
data down the first column. When goods have been
received, a value is entered in the column heading and
against the ref number.The sheet is updated daily
At the end of the week I am looking to condence the
information to only show data with values. The filter
cannot work - Can you help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Looping Macro to remove data where value is 0

Sub DeleteemptyRows()
Dim rng as Range, rng1 as Range
Dim LastRow as Long
set rng = cells(2,2)
lastrow = cells(rows.count,1).End(xlup)

do while rng.row <= Lastrow
if application.countA(rng.Resize(1,255)) = 0 then
if rng1 is nothing then
set rng1 = rng
Else
set rng1 = Union(rng1,rng)
end if
end if
set rng = rng.Offset(1,0)
Loop
if not rng1 is nothing then
rng1.EntireRow.Delete
End if
End sub

Would be one interpretation of what you describe.

--
Regards,
Tom Ogilvy


Paul wrote in message
...
I currently have a speadsheet which has been set up with
various heading across the page and reference numbers as
data down the first column. When goods have been
received, a value is entered in the column heading and
against the ref number.The sheet is updated daily
At the end of the week I am looking to condence the
information to only show data with values. The filter
cannot work - Can you help



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Looping Macro to remove data where value is 0

I read the problem differently from Tom and am kinda simple.

dim i as integer
dim lastrow as integer
lastrow = cells(rows.count,1).End(xlup)

While i <= lastrow
If amt + Sheet1.Columns("B").Rows(i).Value< 0 Then
i = i + 1 'set i to next row
Else 'delete row
Rows(i & ":" & i).Select
Selection.ClearContents
Selection.Delete Shift:=xlUp
End If
Wen

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Looping Macro to remove data where value is 0





*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
Looping Macro KimC Excel Discussion (Misc queries) 1 January 11th 10 04:55 AM
Looping Macro Jase Excel Discussion (Misc queries) 5 March 12th 08 09:08 PM
Looping macro RK Excel Worksheet Functions 2 December 12th 06 11:29 PM
Looping a macro Sony Excel Discussion (Misc queries) 3 October 30th 06 11:52 AM
macro to browse for workbook, pick up data and looping uriel78 Excel Worksheet Functions 1 March 10th 05 12:37 PM


All times are GMT +1. The time now is 12:28 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"