Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Malcolm,
I solved this last week - for somebody else, but do I get a prize for being fastest <vbg? Try the code below. Change the xlNo to xlYes (in two places) and the 1 to a 2 in "For row = 1 To...." if you have a header row. HTH, Bernie MS Excel MVP Sub Macro1() Dim myCell As Range Dim row As Long Range("A:B").Sort key1:=Range("A1"), _ order1:=xlAscending, _ header:=xlNo Range("C:D").Sort key1:=Range("C1"), _ order1:=xlAscending, _ header:=xlNo For row = 1 To Application.CountA(Range("A:A")) If Cells(row, 3).Value < Cells(row, 1).Value Then Cells(row, 3).Resize(1, 2).Insert Shift:=xlDown End If Next row End Sub "Malcolm Davidson" wrote in message ... Hi An intersting problem and one I get every 2 months, so help here would be greatly appreciated. Every 2 months we receive a spreadsheet with new loans that our current clients are entitled to. The problem is, there always seems to be some irritating problems that are quite time consuming. Is it possible to have a spreadsheet with 795 employees with employee ID as the unique Key in column A, his name in column B and then the new entitled loan recipients pasted into the sheet with the ID in column C and the name in Column D. There may only be 500 of the recipients entitled to the loan so there will be 2 columns (A & B) with 795 rows and 2 columns (C & D) with 500 rows. All 500 in column C & D will be in columns A & B but will obviously be out of line. I would like to know if there is a macro or function I could run where the employee ID in column C can line up with it's corresponding Employee ID in column A, obviously bringing the name in Column D with it. This will mean inserting blank cells where needed in columns C & D. I'm baffled just writing this so I hope you can understand what I am trying to achieve. Thanks in advance. M Davidson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
IRR: is there a quickest way? | Excel Worksheet Functions | |||
Quickest way to input formulas? | Excel Discussion (Misc queries) | |||
What is the quickest and easiest way to learn Excel? | New Users to Excel | |||
What is the quickest way to hide a lot of rows and colums ? | Excel Discussion (Misc queries) | |||
Find and Replace - Quickest Option? | Excel Worksheet Functions |