Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I've got two columns that I'm trying to compare. If the 2nd column equals
the first then I want to cut the 2nd column and paste it into another column. CK34041R IC 1 CK38711U IC 1 CMP-AS04S-SINGL SINGLE SPEAKER 1 CK38711U IC 0 CMP-AS04S-SINGL SINGLE SPEAKER 1 CMP-AS14 SPEAKER SET 1 Thanks. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Columns are going down the sheet, are you sure you don't mean comparing
rows? pm wrote: I've got two columns that I'm trying to compare. If the 2nd column equals the first then I want to cut the 2nd column and paste it into another column. CK34041R IC 1 CK38711U IC 1 CMP-AS04S-SINGL SINGLE SPEAKER 1 CK38711U IC 0 CMP-AS04S-SINGL SINGLE SPEAKER 1 CMP-AS14 SPEAKER SET 1 Thanks. |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Bob,
I actually have the data side by side in columns. I want to compare the two and if there is a match, cut the 2nd column and paste it in a separate sheet. Thanks. "Bob I" wrote: Columns are going down the sheet, are you sure you don't mean comparing rows? pm wrote: I've got two columns that I'm trying to compare. If the 2nd column equals the first then I want to cut the 2nd column and paste it into another column. CK34041R IC 1 CK38711U IC 1 CMP-AS04S-SINGL SINGLE SPEAKER 1 CK38711U IC 0 CMP-AS04S-SINGL SINGLE SPEAKER 1 CMP-AS14 SPEAKER SET 1 Thanks. |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() "Bob I" wrote: Columns are going down the sheet, are you sure you don't mean comparing rows? pm wrote: I've got two columns that I'm trying to compare. If the 2nd column equals the first then I want to cut the 2nd column and paste it into another column. CK34041R IC 1 CK38711U IC 1 CMP-AS04S-SINGL SINGLE SPEAKER 1 CK38711U IC 0 CMP-AS04S-SINGL SINGLE SPEAKER 1 CMP-AS14 SPEAKER SET 1 Thanks. Here's a macro I copied from another spreadsheet.....I was trying to modify it Sub CheckInvNos() ' Macro recorded 5/9/2007 by Pam Michalk 'Enter starting column and heading row for the bottom section which will have rows cut sCheckCol = "G" nCheckRow = 15772 'Enter the starting column and heading row for the top section which will be compared sCompareCol = "A" nCompareStart = 1 nCompareRow = nCompareStart sCompare = sCompareCol & nCompareRow bContinue = True Do While bContinue nCheckRow = nCheckRow + 1 sCheck = sCheckCol & nCheckRow Range(sCheck).Select sInvNo = Selection.Value nCompareRow = nCompareStart If IsEmpty(sInvNo) Then bContinue = False Else bCompare = True Do While bCompare nCompareRow = nCompareRow + 1 sCompare = sCompareCol & nCompareRow Range(sCompare).Select sCompInvNo = Selection.Value If sInvNo = sCompInvNo Then Range(sCheck).Select Selection.EntireRow.Cut Sheets("Sheet3").Select ActiveSheet.Paste nCheckRow = nCheckRow + 1 bCompare = False ElseIf IsEmpty(sCompInvNo) Then bCompare = False End If Loop End If Loop End Sub Thanks. |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
This will compare cells in A with cells in B in rows 1 thru 20 and if
they all match cut B1:B20 from sheet 1 and insert into column A of Sheet2. Sub Macro2() ' ' Macro2 Macro ' ' Sheets("Sheet1").Select y = 0 For x = 1 To 20 LCell = "A" & x RCell = "B" & x If Range(LCell) = Range(RCell) Then y = y + 1 End If Next x If y = 20 Then Range("B1:B20").Select Selection.Cut Sheets("Sheet2").Select Range("A1:A20").Select Selection.Insert Shift:=xlToRight Sheets("Sheet1").Select Range("A1:A20").Select End If End Sub pm wrote: Hi Bob, I actually have the data side by side in columns. I want to compare the two and if there is a match, cut the 2nd column and paste it in a separate sheet. Thanks. "Bob I" wrote: Columns are going down the sheet, are you sure you don't mean comparing rows? pm wrote: I've got two columns that I'm trying to compare. If the 2nd column equals the first then I want to cut the 2nd column and paste it into another column. CK34041R IC 1 CK38711U IC 1 CMP-AS04S-SINGL SINGLE SPEAKER 1 CK38711U IC 0 CMP-AS04S-SINGL SINGLE SPEAKER 1 CMP-AS14 SPEAKER SET 1 Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Compare 4 columns? | Excel Worksheet Functions | |||
compare columns | Excel Worksheet Functions | |||
Compare Columns | Excel Discussion (Misc queries) | |||
Compare two columns | Excel Discussion (Misc queries) |