The following code loads up Datastor with column headings and 1 row of data from one worksheet and I want to then copy the same row from another worksheet to compare the difference
The problem I'm having is that the Cells.Find(What:=DataStor(0, 1).... is not finding & activating the correct cell in the new spreadsheet
DataStor(0,1) is a unique identifier common in both worksheets and the value is stored correcty
Any ideas?
The problem I'm having is that the Cells.Find(What:=DataStor(0, 1).... is not finding & activating the correct cell in the new spreadsheet
DataStor(0,1) is a unique identifier common in both worksheets and the value is stored correcty
Any ideas?
Code:
Sub ChangeControl()
Dim DataStor(150, 2) As Variant
Dim BP_Column As Range
Erase DataStor
rowcnt = 0
Worksheets("ORIGINAL BP").Activate
With ActiveSheet
colcntORIG = 0
For Each BP_Column In Intersect(.UsedRange, .Range("a98:g98"))
On Error Resume Next
bpCellDataORIG = ""
ActiveCell.Select
If ActiveCell.Offset(rowcnt + 2, colcntORIG).Value <> "" Then bpCellDataORIG = ActiveCell.Offset(rowcnt + 2, colcntORIG).Value
DataStor(colcntORIG, 0) = BP_Column
DataStor(colcntORIG, 1) = bpCellDataORIG
colcntORIG = colcntORIG + 1
Next
End With
Worksheets("NEW BP").Activate
With ActiveSheet
colcntNEW = 0
Cells.Find(What:=DataStor(0, 1), After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
).Activate
ActiveCell.Select
Do While colcntNEW <> colcntORIG
bpCellDataNEW = ""
If ActiveCell.Offset(0, colcntNEW).Value <> "" Then bpCellDataNEW = ActiveCell.Offset(0, colcntNEW).Value
DataStor(colcntNEW, 2) = bpCellDataNEW
colcntNEW = colcntNEW + 1
Loop
End With
End Sub