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

Greetings all, first timer here.

Need some help trying to get my first processor built using VBA in
Excel.

Trying to get two formulas to work but having some difficulty.

First, trying to get VBA to search the open worksheet and if the sum of
two cells in two different columns equals the number in a 3rd column,
then delete row.

Second, a simple if then statement of deleting duplicate rows. Here is
what I have but it doesn't work. The data is all in column 1.


Public Sub Format(wb As Workbook)
Dim rngRow As Range
Dim lngRows As Long
Dim lngCurRow As Long
Dim rngTable As Range

Set rngTable = wb.Worksheets(1).Cells(1).CurrentRegion
lngRows = rngTable.Rows.Count

For lngCurRow = lngRows To 2 Step -1
Set rngRow = rngTable.Rows(lngCurRow)
If rngRow.Cells("Booking") = rngRow.Cells("Booking").Offset(-1, 0)
Then rngRow.EntireRow.Delete
End If
Next
Set rngTable = wb.Worksheets(1).Cells(1).CurrentRegion
lngRows = rngTable.Rows.Count

If anyone can assist it would be greatly appreciated.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Programming a processor

Cells doesn't accept a string like "Booking" as an argument. Even if it
did, it is unclear how you would use a named range in conjunction with a
row.

If Booking were a named range referring to a column then

set myrng = Intersect(rngRow.EntireRow,Range("Booking").Entire column)
if myrng = myrng.offset(-1,0) then
myrng.Entirerow.Delete
End if


or

For lngCurRow = lngRows To 2 Step -1
If cells(lngCurRow,3)= cells(lngCurRow-1,3) then
rows(lngCurRow).Delete
End If
Next

--
Regards,
Tom Ogilvy



"macrolad" wrote in message
...
Greetings all, first timer here.

Need some help trying to get my first processor built using VBA in
Excel.

Trying to get two formulas to work but having some difficulty.

First, trying to get VBA to search the open worksheet and if the sum of
two cells in two different columns equals the number in a 3rd column,
then delete row.

Second, a simple if then statement of deleting duplicate rows. Here is
what I have but it doesn't work. The data is all in column 1.


Public Sub Format(wb As Workbook)
Dim rngRow As Range
Dim lngRows As Long
Dim lngCurRow As Long
Dim rngTable As Range

Set rngTable = wb.Worksheets(1).Cells(1).CurrentRegion
lngRows = rngTable.Rows.Count

For lngCurRow = lngRows To 2 Step -1
Set rngRow = rngTable.Rows(lngCurRow)
If rngRow.Cells("Booking") = rngRow.Cells("Booking").Offset(-1, 0)
Then rngRow.EntireRow.Delete
End If
Next
Set rngTable = wb.Worksheets(1).Cells(1).CurrentRegion
lngRows = rngTable.Rows.Count

If anyone can assist it would be greatly appreciated.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



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
Text Item Processor littleredhairedgirl Excel Worksheet Functions 1 October 24th 09 01:05 PM
Calculate:Calculating Processor(s) Amit Patel Excel Discussion (Misc queries) 0 October 3rd 09 06:08 AM
how do i take somthing off the word processor and put it in a fil 1 Excel Worksheet Functions 5 December 13th 07 08:53 PM
Macros Pegging Processor ! jsi69i Excel Discussion (Misc queries) 0 May 6th 06 01:54 AM


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