Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

How could I accomplish the below scenerio

  Asked By: Barabbas    Date: Nov 12    Category: MS Office    Views: 753
  

How could I accomplish the below scenerio:

I have three columns in the same worksheet:

Column A, Column B, and Column C.

Column A and B contain 15 didget numbers and Column C contains 7
didget number.

Column A contains certain number, and Column B contains certain
number.
Most of the numbers in Column A & B match.

I want to compare Column's B & A and if the numbers don't match,
I want to shift cell in column B and Cdown till it finds a match
in Column A so that Column B matches Column A and also at the same
time move the corresponding value in Column C down with the Column B
that is being moved down.

I would like all of this to be done automatically. using Excel Macro

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Jawwad Akram     Answered On: Nov 12

Try this

paste this macro  into the VBA editor

Option Explicit

Sub lineupnumbers()


' Macro by David Grugeon
'
Dim X
Dim Y

X = Selection.Row
Y = Selection.Rows.Count
Y = Y + X - 1
For X = X To Y
If Range("A" & X) <> Range("B" & X) Then
Range(("B" & X), ("C" & X)).Select
Selection.Insert Shift:=xlDown
End If
Next X
End Sub

Then select all the rows with numbers  in column  A
Then run the macro

 
Answer #2    Answered By: Shirley Allen     Answered On: Nov 12


1) Do not post the same question twice under different subjects.

2) Do not request fast response - especially without giving a very good
reason for why your question should take priority over other questions (and
over our own priorities in life).

3) You must do the first part of the work. This is not a programming
service. What have you done so far? Post your reasoning and/or your code.

 
Didn't find what you were looking for? Find more on How could I accomplish the below scenerio Or get search suggestion and latest updates.




Tagged: