LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Preserving cell validation on worksheets post data merging


I am merging data from 2 worksheets into a 3rd worksheet within the same
workbook, and I have this 'merge' to happen automatically when a user
opens the workbook.

The first worksheet is called "AUTO-ASSIGNED" and there are 12 columns
(A to L) that contain data. The row count will vary all the time so
there is nothing fixed about it.

The second worksheet is called "SELF-ASSIGNED" and it also has 12
columns (A to L) that contain data. The row count will vary all the time
so there is also nothing fixed about it.

I copy and paste the data on both of these worksheets into a 3rd
worksheet within the same workbook called "LEAD SUMMARY" starting in
cell A2, and list/sort the data based on date (column D on both sheets
contains a key date).

Row 1 of each of the worksheets contains the column titles:

Title; Sname; Fname; Date Received; Date Allocated; Product Type;
Product Quantity; City; Region; Ad Source; Media Type; Assigned To

For each iteration of this action the 'copied and pasted' data is added
into the summary sheet while preserving the data already present from
the first iteration. And so on with a third and fourth iteration.

I clear the AUTO-ASSIGNED and SELF-ASSIGNED worksheets after the LEADS
SUMMARY sheet has the data on it with each iteration, so as to remove
data duplication within the workbook.

I ahve code that can do this, but there is still one stumbing block: I
have cell validation on the AUTO-ASSIGNED and SELF-ASSIGNED and this
gets wiped on the first iteration, so I need to find a way to correct
this so validation remains.

So far, I've put the following code in the workbook:

Private Sub Workbook_Open()
Application.ScreenUpdating = False
Dim NextRow As Long, DestSheet As Worksheet
Set DestSheet = Worksheets("LEAD SUMMARY")
With DestSheet
NextRow = .Cells.Find(What:="*", After:=.Range("A1"),
SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
End With
With Worksheets("AUTO-ASSIGNED").Range("A1").CurrentRegion
If .Rows.Count 1 Then .Offset(1).Resize(.Rows.Count - 1,
..Columns.Count).Cut DestSheet.Cells(NextRow, 1)
End With
With DestSheet
NextRow = .Cells.Find(What:="*", After:=.Range("A1"),
SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
End With
With Worksheets("SELF-ASSIGNED").Range("A1").CurrentRegion
If .Rows.Count 1 Then .Offset(1).Resize(.Rows.Count - 1,
..Columns.Count).Cut DestSheet.Cells(NextRow, 1)
End With
With DestSheet
If WorksheetFunction.CountA(.Columns(4)) 1 Then
..Range("A1").CurrentRegion.Sort Key1:=.Range("D2"), Order1:=xlAscending,
Header:=xlYes
End With
Set DestSheet = Nothing
Application.ScreenUpdating = True
End Sub

I am using Excel 2003.

Any direction anyone could provide would be much appreciated.

Many thanks and please!


--
bradyj
------------------------------------------------------------------------
bradyj's Profile: http://www.thecodecage.com/forumz/member.php?userid=397
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=104543

 
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
MERGING DATA FROM SEVERAL WORKSHEETS tammy p Excel Worksheet Functions 4 July 31st 09 04:29 PM
Data merging with 2 worksheets markmerid Excel Worksheet Functions 2 March 17th 09 02:32 PM
Merging data from 2 worksheets brownmre Excel Worksheet Functions 1 February 10th 09 10:40 PM
Merging data from different worksheets ajwilki Excel Discussion (Misc queries) 1 November 21st 06 02:59 PM
Merging 3 Columns in an Excel Spreadsheet (Keeping Data Intact)...2nd Post : VB : Excel Programming 2 August 16th 03 09:39 AM


All times are GMT +1. The time now is 04:08 PM.

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"