You are welcome. I have to apologize to you though... I meant to put the
worksheet names in section you fill in so you wouldn't have had to search
for them in the actual code. In case you (or other readers of this thread)
might find it useful, here is that code (with it, you only have to change
values in the marked-off section and nowhere else) ...
Sub ConsolidateData()
Dim CurrentID As String
Dim LastCellInRow As Long
Dim DataHeaderRow As Long
Dim ReportHeaderRow As Long
' *********************************************
' * Set your worksheet values in this section *
' *********************************************
Const DataSheetName = "Data"
Const DataIDCol = "A"
Const DataCountryCol = "B"
Const DataNumberCol = "C"
DataHeaderRow = 1 '0 if no header
Const ReportSheetName = "Report"
Const ReportIDCol = "A"
Const ReportRelatedMattersCol = "B"
ReportHeaderRow = 1 '0 if no header
' *********************************************
With Worksheets(DataSheetName)
CurrentID = .Cells(2, DataIDCol).Value
LastCellInRow = .Cells(.Rows.Count, DataIDCol).End(xlUp).Row
Do While DataHeaderRow <= LastCellInRow
DataHeaderRow = DataHeaderRow + 1
If .Cells(DataHeaderRow, DataIDCol).Value <> "" Then
ReportHeaderRow = ReportHeaderRow + 1
CurrentID = .Cells(DataHeaderRow, DataIDCol).Value
Worksheets(ReportSheetName).Cells(ReportHeaderRow, _
ReportIDCol).Value = CurrentID
Worksheets(ReportSheetName).Cells(ReportHeaderRow, _
ReportRelatedMattersCol).Value = _
.Cells(DataHeaderRow, DataCountryCol).Value & " " & _
.Cells(DataHeaderRow, DataNumberCol).Value
Else
Worksheets(ReportSheetName).Cells(ReportHeaderRow, _
ReportRelatedMattersCol).Value = _
Worksheets(ReportSheetName).Cells(ReportHeaderRow, _
ReportRelatedMattersCol).Value & "; " & _
.Cells(DataHeaderRow, DataCountryCol).Value & " " & _
.Cells(DataHeaderRow, DataNumberCol).Value
End If
If DataHeaderRow = LastCellInRow Then Exit Do
Loop
End With
End Sub
Rick
> Oh, that is a thing of great beauty Rick, thank you very much, works
> perfectly!
[quoted text clipped - 97 lines]
>> >
>> > Thanks in advance for any help/ideas anyone can give!
Dawn - 14 May 2008 22:34 GMT
Cool thanks -- I just named my tabs "Data" and "Report" like you did, which
works fine for my purposes, but this is a nice improvement. Thanks again!
> You are welcome. I have to apologize to you though... I meant to put the
> worksheet names in section you fill in so you wouldn't have had to search
[quoted text clipped - 152 lines]
> >> >
> >> > Thanks in advance for any help/ideas anyone can give!
Kerry - 10 Sep 2008 19:09 GMT
Rick...I like this concept. I have similar data that has Firm_Name in Column
A, ContactEmail in Column N, ExecutiveEmail in Column S. Each Firm has
multiple office locations, therefore can have multiple rows of information.
In to create a column of email address that I can use to automatically email
files to these addresses. One thing I need to do is check to make sure emails
are not the same.
My Date
Firm_Name ContactEmail ExecutiveEmail
ABC 1@abc.com 2@abc.com
ABC 1@abc.com 3@abc.com
XYZ 1@xyz.com 2@xyz.com
AXX 2@abc.com
ContactMail needs to be who the email is sent to, and ExecutiveEmail needes
to be cc. If ContactEmail = ExecutiveEmail then only use ContactEmail in To
and cc ExecutiveEmail. If ContactEmail <> ExecutiveEmail then ContactEmail To
and ExectutiveEmail cc. Sometimes Contact email is blank and there are
multiple ExecutiveMail rows, I would like to use an additional comumn where
ExecutivePostition is used to select who email is addressed to and cc to. Can
this be done?
Thanks,
Kerry
> You are welcome. I have to apologize to you though... I meant to put the
> worksheet names in section you fill in so you wouldn't have had to search
[quoted text clipped - 152 lines]
> >> >
> >> > Thanks in advance for any help/ideas anyone can give!