Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How would one merge this into 1 cell

User1 User2
----------------------------------------
Table1 Create 1 1
Table1 Alter 1
Table2 Create 1
Tabel2 Alter 1 1

What I need to do is substitute the 1's with the value in column 2 and,
ideally, if the tablename is the same (column1) put both values in column2
into 1 cell. I need to do this for a sheet with approx 30 columns (only 1st 2
have values as above) amd 3000+ rows.

I am somewhat familiar with macros and vb but this is beyond me (i think),
any pointers greatly appreciated.

have a good weekend!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default How would one merge this into 1 cell

Your request is a bit cryptic. Could you provide some additional info?

"Riskybizniz" wrote:

User1 User2
----------------------------------------
Table1 Create 1 1
Table1 Alter 1
Table2 Create 1
Tabel2 Alter 1 1

What I need to do is substitute the 1's with the value in column 2 and,
ideally, if the tablename is the same (column1) put both values in column2
into 1 cell. I need to do this for a sheet with approx 30 columns (only 1st 2
have values as above) amd 3000+ rows.

I am somewhat familiar with macros and vb but this is beyond me (i think),
any pointers greatly appreciated.

have a good weekend!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How would one merge this into 1 cell

Dear Barb, ofcourse.
the columns are userids, the rows are tables (col1) and rights (col2).
the 1's indicate that a user has the right on that specific table. Col1 has,
as said, the tables and this value repeats for each right on that table. What
I need to do is a) replace the cell with 1st occurence (the '1' under user)
with all the rights listed in col2 and then b) condense all the tables into 1
per table so that the sheet would look like this:
Table: | Right | User1 | User 2 |
+------+--------+--------------+---------------+
|table1| |Create, Alter|Create |
+------+-------+---------------+---------------+
|table2| |Create |Create, Alter|
+------+-------+---------------+---------------+
If you use the 'table' listed in my first post.
Does this clarify my question somewhat?
kindest regards,
Chris

"Barb Reinhardt" wrote:

Your request is a bit cryptic. Could you provide some additional info?

"Riskybizniz" wrote:

User1 User2
----------------------------------------
Table1 Create 1 1
Table1 Alter 1
Table2 Create 1
Tabel2 Alter 1 1

What I need to do is substitute the 1's with the value in column 2 and,
ideally, if the tablename is the same (column1) put both values in column2
into 1 cell. I need to do this for a sheet with approx 30 columns (only 1st 2
have values as above) amd 3000+ rows.

I am somewhat familiar with macros and vb but this is beyond me (i think),
any pointers greatly appreciated.

have a good weekend!


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How would one merge this into 1 cell

Try this against a copy of your worksheet--it destroys the original when it's
working.

Option Explicit
Sub testme()

Dim wks As Worksheet
Dim iRow As Long
Dim iCol As Long
Dim FirstRow As Long
Dim LastRow As Long
Dim FirstCol As Long
Dim LastCol As Long
Dim mySep As String

Set wks = Worksheets("Sheet1")

With wks
FirstRow = 2 'headers in row 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
FirstCol = 1
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column

'sort the data by column A
With .Range(.Cells(FirstRow - 1, FirstCol), .Cells(LastRow, LastCol))
.Cells.Sort key1:=.Columns(1), order1:=xlAscending, _
key2:=.Columns(2), order2:=xlAscending, _
header:=xlYes
End With

With .Range(.Cells(FirstRow, FirstCol + 2), .Cells(LastRow, LastCol))
'no formulas!
.Value = .Value
On Error Resume Next 'just in case
.Cells.SpecialCells(xlCellTypeConstants).FormulaR1 C1 = "=rc2"
On Error GoTo 0
.Value = .Value
End With

For iRow = LastRow To FirstRow + 1 Step -1
If .Cells(iRow, "A").Value = .Cells(iRow - 1, "A").Value Then
'still in same group, do some work
For iCol = FirstCol + 2 To _
.Cells(iRow, .Columns.Count).End(xlToLeft).Column
If .Cells(iRow, iCol).Value = "" Then
'skip it
Else
mySep = ", "
If .Cells(iRow - 1, iCol).Value = "" Then
mySep = ""
End If
.Cells(iRow - 1, iCol).Value _
= .Cells(iRow - 1, iCol).Value _
& mySep & .Cells(iRow, iCol).Value
End If
Next iCol
'do with that row
.Rows(iRow).Delete
End If
Next iRow
'delete column B????
.Columns(FirstCol + 1).Delete
'fit the columns
.UsedRange.Columns.AutoFit
End With
End Sub


Riskybizniz wrote:

Dear Barb, ofcourse.
the columns are userids, the rows are tables (col1) and rights (col2).
the 1's indicate that a user has the right on that specific table. Col1 has,
as said, the tables and this value repeats for each right on that table. What
I need to do is a) replace the cell with 1st occurence (the '1' under user)
with all the rights listed in col2 and then b) condense all the tables into 1
per table so that the sheet would look like this:
Table: | Right | User1 | User 2 |
+------+--------+--------------+---------------+
|table1| |Create, Alter|Create |
+------+-------+---------------+---------------+
|table2| |Create |Create, Alter|
+------+-------+---------------+---------------+
If you use the 'table' listed in my first post.
Does this clarify my question somewhat?
kindest regards,
Chris

"Barb Reinhardt" wrote:

Your request is a bit cryptic. Could you provide some additional info?

"Riskybizniz" wrote:

User1 User2
----------------------------------------
Table1 Create 1 1
Table1 Alter 1
Table2 Create 1
Tabel2 Alter 1 1

What I need to do is substitute the 1's with the value in column 2 and,
ideally, if the tablename is the same (column1) put both values in column2
into 1 cell. I need to do this for a sheet with approx 30 columns (only 1st 2
have values as above) amd 3000+ rows.

I am somewhat familiar with macros and vb but this is beyond me (i think),
any pointers greatly appreciated.

have a good weekend!



--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cant merge cell Dadada Excel Discussion (Misc queries) 2 December 19th 09 01:41 PM
how to merge many cell to one cell with keeping all data Valley Excel Worksheet Functions 0 August 25th 06 01:12 PM
How to merge one cell from many workbooks to one cell on one work Marc Excel Worksheet Functions 2 October 31st 05 02:07 AM
Merge cell & Copy Data from different cell MK Excel Discussion (Misc queries) 0 June 24th 05 10:54 AM
How do I merge 2 cells for ex. DE (1 cell) & 01234 (2 cell) into . DaysofSomer Excel Discussion (Misc queries) 1 January 31st 05 07:55 PM


All times are GMT +1. The time now is 12:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"