View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
AllyB AllyB is offline
external usenet poster
 
Posts: 3
Default VB, Vlookup worksheet function and copying data

Hello,

I have a spreadsheet that lists deliverables and based on a y/n creates a
second sheet to track the necessary approvals. Deliverables are associated
with a project phase, and must be sorted in order of phase (but within a
phase no sorting is necessary). Once the approvals sheet is created, cells
must be populated with NA if a role does not need to approve a deliverable.
As approvals are granted, the date must be populated in the appropriate cell.
This all works wonderfully as long as there are no updates to be done. It
is entirely possible, however, that a new deliverable can be identified and
the approvals sheet be updated to include this new deliverable in the
appropriate phase. I've been able to get the NA recreation code to work, but
cannot get the dates that have already been input to copy with the
appropriate deliverable. My approach has been to copy the current approval
range (cells B11 to Q132) to AB11:AQ32 and then do a loop to look at the
value in the current row of B, find that in the first column of the backup
range (AB11:AQ132) and then copy the range of AH##:AQ##, where ## is the row
in which the copy resides, to the range of H%%:Q%% where %% is the row of the
value in B we are looking up. The code I've done to date is noted below but
doesn't work. Any and all help on this will be greatly, greatly
appreciated!!!



Private Sub RecoverDates()

Dim strCurrCell As String
Dim intCurRow As Integer
Dim strUpdateCell As Range

Dim strLookupCell As Variant
Dim strUpdateRow As Range
Dim strUpdateRange As Range
Dim strFindRange As Range
Dim strCopyfromRange As Range


intCurRow = 11
For intCurRow = 11 To 90
Set strFindRange = Worksheets("Project Approval
Meetings").Range("$AB$11:$AQ$132")
num = Application.Match("'$B$" & intCurRow & "'",
strFindRange.Columns(1), 0)
Set strUpdateCell = strFindRange(num, 8)
If (Not (strUpdateRange Is Nothing)) Then
strUpdateRow = "$H$" & strUpdateRow & ":$Q$" & strUpdateRow
strCopyfromRange = "$AH$" & strUpdateRow & ":$AQ$" & strUpdateRow
strCopyfromRange.Select
strUpdateRow = strCopyfromRange
End If
Next
End Sub