Excel Compare/move cells in columns, call from Sweden :: MrExcel Message Board



 FAQFAQ
   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   FavoritesFavorites   StatisticsStatistics 
 RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Online StoreOnline Store

MrExcel Message Board Forum Index -> Excel Questions

Compare/move cells in columns, call from Sweden
Post new topic   Reply to topic
Last Thread | Next Thread  >   Printable version
  Author    Thread

Goldmund
Welcome to the Board


Joined: 15 Mar 2002
Posts: 3


Status: Offline

 Reply with quote  

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

Post Fri Mar 15, 2002 7:02 pm 
 View user's profile Send private message

smozgur
Board Master


Joined: 01 Mar 2002
Posts: 411
Location: Istanbul, Turkiye

Status: Offline

 Reply with quote  

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.


Post Mon Mar 18, 2002 8:44 am 
 View user's profile Send private message Yahoo Messenger

Goldmund
Welcome to the Board


Joined: 15 Mar 2002
Posts: 3


Status: Offline

 Reply with quote  

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

Post Mon Mar 18, 2002 4:26 pm 
 View user's profile Send private message

smozgur
Board Master


Joined: 01 Mar 2002
Posts: 411
Location: Istanbul, Turkiye

Status: Offline

 Reply with quote  

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

Post Mon Mar 18, 2002 5:50 pm 
 View user's profile Send private message Yahoo Messenger

Goldmund
Welcome to the Board


Joined: 15 Mar 2002
Posts: 3


Status: Offline

 Reply with quote  

Thanks,

that was exactly what I asked for, it works just fine.

Thanks again

/Mat

Post Tue Mar 19, 2002 9:25 am 
 View user's profile Send private message

smozgur
Board Master


Joined: 01 Mar 2002
Posts: 411
Location: Istanbul, Turkiye

Status: Offline

 Reply with quote  

It's my pleasure.


Post Tue Mar 19, 2002 1:31 pm 
 View user's profile Send private message Yahoo Messenger
  Display posts from previous:      

MrExcel Message Board Forum Index -> Excel Questions


Forum Jump:
Jump to:  

Post new topic   Reply to topic
Page 1 of 1



Add To Favorites

 


Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB: 2.0.4 © 2001 phpBB Group

Need help posting your first question? Read how to post

Need extra help ? Couldn't get the answer you needed ? Get a free quote from our Consulting Team

Download Colo's HTML Maker utility for displaying your Excel Worksheet on the board.

Download VB HTML Maker to post your code on the board


Check out our new index to 485 Excel Articles.


Return to MrExcel Consulting

All contents Copyright 1998-2004 by MrExcel.com
If you believe information posted here is from your copyrighted source, notify us per the Terms of Use
Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.