![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Posts: 3
|
Hi,
I wonder if anyone can help me on this one? I have 3 columns with almost identical values of this type, "FE10H", in columns A & B and numeric values in cC . They are however on diffrent rows, but all in the same order in the columns (its from a mimer database). Is there a simple way (code)to compare for ex. "A1" & "B1", and if content in "A1" <> "B1" move content in "B1"& "C1" to the row in column B where "A" = "B". Could this be repeated until column A = cB? Thanks in advance /Mat |
|
|
|
|
|
#2 |
|
BatCoder
Join Date: Feb 2002
Location: Turkey
Posts: 764
|
Ok but something i am missing: move to row A=B, which row?: the last row has A=B equality just before current row?
Or it could be better if you can show us some data. |
|
|
|
|
|
#3 |
|
New Member
Join Date: Mar 2002
Posts: 3
|
Thank you for the reply
This is what I had in mind. What I need is to match the content in column A with the content in column B (and also move the content in column C with it). In this example iŽd like AR10H (columnB row 2) and 4 (column C row 2) to move down to AR10H (column A)and so on..(just like row 1) All this until column A=B A B C AT13H AT13H 4,33 AT20H AR10H 4 AR10H AS19D x AR11H AS21D x AR20H BS10H i.s AR30H BS20H i.s AS19D BS25D pg AS21D BK10H 4,31 See what I mean? I appreciate Your help! /Mat |
|
|
|
|
|
#4 |
|
BatCoder
Join Date: Feb 2002
Location: Turkey
Posts: 764
|
I am not sure this is exactly you want but it does like your sample. What about if B1 value doesnot exist in any A column cell? Below code does do nothing in this case.
Private Sub JustDoIt() Dim i As Integer Dim j As Integer i = 1 With ActiveSheet Do Until .Cells(i, 1) = "" j = 0 Do Until .Cells(i + j, 1) = .Cells(i, 2) If .Cells(i + j, 1) = "" Then GoTo fin j = j + 1 Loop If Not j = 0 Then strRange = "B" & Trim(Str(i)) & ":C" & Trim(Str(j + i - 1)) .Range(strRange).Select Selection.Insert Shift:=xlDown i = j + i - 1 End If i = i + 1 Loop End With fin: Range("A1").Select End Sub suat |
|
|
|
|
|
#5 |
|
New Member
Join Date: Mar 2002
Posts: 3
|
Thanks,
that was exactly what I asked for, it works just fine. Thanks again /Mat |
|
|
|
|
|
#6 |
|
BatCoder
Join Date: Feb 2002
Location: Turkey
Posts: 764
|
It's my pleasure.
|
|
|
|
|
|
#7 |
|
New Member
Join Date: Aug 2009
Posts: 11
|
Hello,
What if I have something like this? A B C D E F xxx xxxx xxx 123 123 xxx xxxx xxx 123A 123B xxx xxxx xxx 123B 123C Is it possible to leave column A, B, C, D untouched and match against column E from column D? If E matches D then leave in the same row and if E does not match D then move to column F? Basically, I have a set of transactions from one system which is column D and I have another set of transactions from another system which may or may not have the same transaction from column D. They are all sorted from + to -. I just need to match up cells from column E to column D. I really appreciate it if you can come up with a macro like that. Thanks, Peter |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|