Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello All.
In excel, I need to keep the first row when it is followed by other rows with the first two cells the same. Therefo CELLA CELLB CELLC 21 COMPANY TEXT VARIES - keep 21 COMPANY TEXT VARIES - delete 22 COMPANY TEXT VARIES - keep 22 COMPANY TEXT VARIES - delete 22 COMPANY TEXT VARIES - delete 23 COMPANY TEXT VARIES - keep 23 COMPANY TEXT VARIES - delete 23 COMPANY TEXT VARIES - delete 23 COMPANY TEXT VARIES - delete Make sense?? Please help me. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub DeleteRows()
Dim iRow As Integer Dim ws As Worksheet Set ws = Sheets("Sheet1") iRow = 1 Do If ws.Cells(iRow + 1, "A") = ws.Cells(iRow, "A") _ And ws.Cells(iRow + 1, "B") = ws.Cells(iRow, "B") Then ws.Rows(iRow + 1).Delete Else iRow = iRow + 1 End If Loop Until ws.Cells(iRow + 1, "A") = "" End Sub HTH, Merjet |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Set currentcell = Range("A1")
do while not isempty(currentCell) Set nextcell = currentcell.Offset(1,0) if currentcell.value = nextcell.value then nextcell.entirerow.delete Set nextcell = currentcell.offset(1,0) else set currentcell = nextcell end if loop -----Original Message----- Hello All. In excel, I need to keep the first row when it is followed by other rows with the first two cells the same. Therefo CELLA CELLB CELLC 21 COMPANY TEXT VARIES - keep 21 COMPANY TEXT VARIES - delete 22 COMPANY TEXT VARIES - keep 22 COMPANY TEXT VARIES - delete 22 COMPANY TEXT VARIES - delete 23 COMPANY TEXT VARIES - keep 23 COMPANY TEXT VARIES - delete 23 COMPANY TEXT VARIES - delete 23 COMPANY TEXT VARIES - delete Make sense?? Please help me. . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello.
Using the information below, I am getting the following error "Set ws = Sheets("Sheet1")". What does that mean?? How do I fix it? Thank you for all of your help. "merjet" wrote in message ... Sub DeleteRows() Dim iRow As Integer Dim ws As Worksheet Set ws = Sheets("Sheet1") iRow = 1 Do If ws.Cells(iRow + 1, "A") = ws.Cells(iRow, "A") _ And ws.Cells(iRow + 1, "B") = ws.Cells(iRow, "B") Then ws.Rows(iRow + 1).Delete Else iRow = iRow + 1 End If Loop Until ws.Cells(iRow + 1, "A") = "" End Sub HTH, Merjet |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Programmer wanna be,
Perhaps you do not have a sheet named Sheet1. Try replacing Sheet1 with the name of your sheet. --- Regards, Norman "Programmer wanna be" wrote in message m... Hello. Using the information below, I am getting the following error "Set ws = Sheets("Sheet1")". What does that mean?? How do I fix it? Thank you for all of your help. "merjet" wrote in message ... Sub DeleteRows() Dim iRow As Integer Dim ws As Worksheet Set ws = Sheets("Sheet1") iRow = 1 Do If ws.Cells(iRow + 1, "A") = ws.Cells(iRow, "A") _ And ws.Cells(iRow + 1, "B") = ws.Cells(iRow, "B") Then ws.Rows(iRow + 1).Delete Else iRow = iRow + 1 End If Loop Until ws.Cells(iRow + 1, "A") = "" End Sub HTH, Merjet |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formatting ALL data labels for ALL data series at once | Charts and Charting in Excel | |||
Formatting data series - line between certain data points only | Charts and Charting in Excel | |||
Formatting Rows of Data based on Column Data | Excel Worksheet Functions | |||
How can I cut data out of HTML table, into msExcel and just take the data & columns? (but NOT the formatting & URLs!) | Excel Discussion (Misc queries) | |||
Formatting data | Excel Discussion (Misc queries) |