Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all
i have a spreadsheet with the following data.... Col A Col B Col C Col D Col E ABC 123 A1 ABC A1&123 A2 ABC A2&123 A3 ABC A3&123 DEF 456 A1 DEF A1&456 A2 DEF A2&456 GHI 789 A1 GHI A1&789 A4 GHI A2&789 What I am trying to do is check Col A and B with Col C, D, E. The latter is added manually the former automatically so always wnat to check that in line 2 col D it matches with col A line 1 and col E matches with col C and Col B. My code so far to do this is below but having problems with the looping and holding col A and B to do the check. Any help would be appreciated. Thanks very much. Sub datachecker() Dim n, myLen As Integer Dim myTemplate, mynode, myComp, myLinkType As String Application.ScreenUpdating = False With ThisWorkbook.Sheets(7) Do Until Range("E2").Offset(n, 0).value = "" If Range("A2").Offset(n, 0).value < "" Then mynode = Range("A2").Offset(n, 0).value Do Until Range("A2").Offset(n + 1, 0).value < "" If Range("A2").Offset(n, 0).value < Range("F2").Offset(n, 0).value Then Range("F2").Offset(n, 0).value = Range("A2").Offset(n, 0).value End If Set lngEndRow = Range("A2", Range("A2").End(xlDown)) If Range("B2").Offset(n, 0).value < "" Then myTemplate = Range("B2").Offset(n, 0).value ElseIf VBA.Left(Range("A2").Offset(n, 0).value, 2) = "HP" Then myTemplate = "HP" End If If Range("C2").Offset(n, 0).value < "" Then myComp = Range("C2").Offset(n, 0).value myLinkType = myTemplate & "_" & myComp myLen = VBA.Len(myLinkType) End If If VBA.Left(Range("G2").Offset(n, 0).value, myLen) < myLinkType Then MsgBox "Correct" End If n = n + 1 Loop End If n = n + 1 Loop End With Application.ScreenUpdating = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Looping and deleting thru cells which values offset | Excel Programming | |||
looping through an giving values to cells in vba | Excel Discussion (Misc queries) | |||
Looping thru values in a Range of Cells | Excel Programming | |||
Holding form control values within VBA | Excel Programming | |||
#Holding values in different format# | Excel Programming |