Computing.Net > Forums > Office Software > Tricky excel question

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Tricky excel question

Reply to Message Icon

Name: cx222
Date: March 23, 2006 at 17:48:45 Pacific
OS: XP
CPU/Ram: intel
Comment:

I would like to copy the cells from column A and column B (entire range) into column C. How can I automate this process so that it constantly copies newly added cells to column A or B into column C, and then sorts column C ascending?



Sponsored Link
Ads by Google

Response Number 1
Name: Jennifer SUMN
Date: March 24, 2006 at 04:36:00 Pacific
Reply:

Do you mean you want to combine the data in a row for Column A and B and then copy that result into Column C? What is the format of the data in A and B?

Soylent Green is PEOPLE!!!


0

Response Number 2
Name: rhawk7938
Date: March 24, 2006 at 08:25:51 Pacific
Reply:

I would do it this way:
In cell C =Sum(A1+B1) copy the formula as needed for the number of rows.

Copy and paste this into the visual basic editor:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Worksheets("Sheet1").Range("C1").Sort Key1:=Worksheets("Sheet1").Column("C"),Header:=xlGuess

End Sub

Note: The middle line "Worksheets...xlGuess" is one line of code



0

Response Number 3
Name: Jennifer SUMN
Date: March 24, 2006 at 10:21:08 Pacific
Reply:

Sum is used assuming of course that there are numbers in Columns A and B.

Soylent Green is PEOPLE!!!


0

Response Number 4
Name: Michael J (by mjdamato)
Date: March 24, 2006 at 14:11:01 Pacific
Reply:

If you are "adding" (concatenating) text then the formula would be = A1&" "&B1

that assumes you want to add a space betweent he two values. If not, it would be just =A1&B1

Michael J


0

Response Number 5
Name: cx222
Date: March 27, 2006 at 07:48:28 Pacific
Reply:

I do not wish to combine the data in rows A and B. The data in these rows will be text.

For example, if A1 contains "65G-123" and B1 contains "65F-43", I want C1 to automatically contain "65F-43" and C2 to contain "65G-123", in that order (sorted ascending). If I add the value "65A-333" to A2, I would like the C column to reorder itself as:

C1: "65A-333"
C2: "65F-43"
C3: "65G-123"

Hope that clears things up a bit.

Thanks for your responses so far!


0

Related Posts

See More



Response Number 6
Name: rhawk7938
Date: March 27, 2006 at 15:57:37 Pacific
Reply:

I came up with this using column D for the sorting of the contents of A & B. It would take some refining but, it might give you some ideas. Hope it helps you.


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim I As Integer
Dim myval
Dim myval2

With Columns("D")
.Clear
.NumberFormat = "@"
End With


For Each cel In UsedRange
cel.NumberFormat = "@"
r = r + 1
If cel.Value > "" Then Cells(r, 4) = cel.Value
Next

Worksheets("Sheet1").Range("D1").Sort
Key1:=Worksheets("Sheet1").Columns("D"), Header:=xlGuess

End Sub

Note: the last 3 lines before end sub, is one line of code


0

Response Number 7
Name: rhawk7938
Date: March 27, 2006 at 15:59:06 Pacific
Reply:

Note: you can leave out the 3 Dim statements. That was from another idea I had.


0

Response Number 8
Name: cx222
Date: March 28, 2006 at 06:38:34 Pacific
Reply:

Thanks rhawk!


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: Tricky excel question

excel question www.computing.net/answers/office/excel-question/7647.html

Microsoft Excel question www.computing.net/answers/office/microsoft-excel-question/2320.html

Excel Questions (Office XP) www.computing.net/answers/office/excel-questions-office-xp/1117.html