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: 5
Default Looping through cells and holding values

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
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
Looping and deleting thru cells which values offset LuisE Excel Programming 1 September 7th 07 05:32 AM
looping through an giving values to cells in vba DowningDevelopments Excel Discussion (Misc queries) 3 August 25th 06 12:39 AM
Looping thru values in a Range of Cells PP Excel Programming 2 July 29th 05 04:12 PM
Holding form control values within VBA Darren Excel Programming 10 December 23rd 04 07:06 PM
#Holding values in different format# Dean Knox[_2_] Excel Programming 2 November 26th 03 02:36 PM


All times are GMT +1. The time now is 07:16 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"