9DravenAlpha
New Member
- Joined
- Nov 28, 2019
- Messages
- 8
- Office Version
- 365
- 2019
- 2016
- 2013
- Platform
- Windows
I have two tables that are on different tabs. One tab is called RawData and the Other is called CSheet. On CSheet, I have a column of data starting in C2. I am needing to compare the CSheet data list to the table that I have on the Raw Data tab. The table on the RawData tab starts in Cell A1 and has headers. Its only a 4x4 table for now, but it will eventually include over 4,000 rows of data that goes into column AJ. The data is updated everyday so I need the code to be able to pick up dynamic ranges.
I am trying to solve his using Arrays, but I am new to them. Below is code that I've tried to so far but its not deleting all of the values in a row.
I am trying to solve his using Arrays, but I am new to them. Below is code that I've tried to so far but its not deleting all of the values in a row.
VBA Code:
Sub DashDataTransfer()
Dim CSheet As Variant
Dim RawData As Variant
Dim i, j, lRow As Long
Dim rng As Range
Sheet4.Activate
CSheet = Range("C2", Range("C2").End(xlDown))
Sheet1.Activate
'RawData = Range("C2", Range("C2").End(xlDown))
Set rng = Sheet1.Cells(2, 1).CurrentRegion
RawData = rng
For i = 2 To UBound(RawData, 2)
For j = 2 To UBound(CSheet)
If CSheet(j, 1) = RawData(i, 1) Then
RawData(1, j) = ""
End If
Next j
Next i
rng = RawData
'rng.Sort rng.Columns(1), xlDescending
End Sub