Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Queries

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 06-22-2009, 05:17 AM
crownedzero crownedzero is offline Windows XP Access 2003 (version 11.0)
Novice
 
Join Date: Jun 2009
Posts: 19
crownedzero is on a distinguished road
Default Convert Excel Macro to Access Query

Code:
Sub Remove_NoStock()
Dim i As Long
Application.ScreenUpdating = False
For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
    If Cells(i, 3) = "D" And _
    Application.WorksheetFunction.SumIf(Range("A:A"), Cells(i, 1), Range("G:G")) = 0 Then
        Cells(i, 1).EntireRow.Delete
    End If
Next
Application.ScreenUpdating = True
End Sub
Column "A" is the ItemNumber but there are multiple sizes of with the same ItemNumber, for each ItemNumber that has 0 in the "G"
Available column for ALL sizes these records do not need to be returned.

Suggestions? Thanks in advance.
Reply With Quote
  #2  
Old 06-22-2009, 12:13 PM
RuralGuy's Avatar
RuralGuy RuralGuy is online now Windows 7 Access 2007 (version 12.0)
Administrator
 
Join Date: Mar 2007
Location: 8300' in the Colorado Rocky Mountains
Posts: 4,263
RuralGuy will become famous soon enoughRuralGuy will become famous soon enough
Default

How about just describing in English what records need to be deleted and maybe those of us not fluent in SpreadSheet will understand.
__________________
(RG for short) aka Allan Bunch MS Access MVP - WinXP Pro, Win7 - acXP, ac07
If your issue is resolved...follow this link for directions on how to use the Solved thread tool!
Teaching is not filling a bucket but lighting a fire. Borrowed quote..."Docendo discimus"
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro To Import CSV to ACCESS csvivek Import/Export Data 1 12-07-2009 10:49 AM
How do I call an Excel macro from Access 2003 KramerJ Access 0 05-07-2009 12:32 PM
Can anyone help me convert this union query into something that will work in access? gbackus Queries 0 12-28-2008 10:56 AM
Convert string to date ~SwAmPdOnKeY~ Queries 4 09-11-2008 05:19 PM
macro help needed: how to set the criteria of a query neodeath Access 0 01-01-2007 11:26 AM


All times are GMT -8. The time now is 02:44 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.