Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 22nd, 2009, 09:43 PM
Registered User
 
Join Date: Oct 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need code corrections "get sub or function not defined" error"

It's suppose to check in col "f" and "G" for duplicates. I get a "sub or Function not defined" error. Thanks

Sub checkfordups()

Dim LLoop As Integer
Dim LTestLoop As Integer
Dim LClearRange As String

Dim Lrows As Integer
Dim LRange As String

'Column F values    
Dim LChangedValue As String
Dim LTestValue As String

   'Column G values    
Dim LChangedValueG As String
Dim LTestValueG As String

   
    'Test the first 200 rows
Lrows = 200
LLoop = 2
    'Clear colors
LClearRange = "F2:G" & Lrows
Range(LClearRange).Interior.ColorIndex = xlNone
  'Check first 200 rows
While LLoop <= Lrows
LChangedValue = "F" & CStr(LLoop)
LChangedValueG = "G" & CStr(LLoop)
If Len(Range(LChangedValue).Value) > 0 Then
'test each value for uniqueness
LTestLoop = 2
While LTestLoop <= Lrows
If LLoop <> LTestLoop Then
LTestValue = "F" & CStr(LTestLoop)
LTestValueG = "G" & CStr(LTestLoop)
'value has been duplicated in another cell
If (Range(LChangedValue).Value = Range(LTestValue).Value) And (Range(LChangedValueG).Value = Range(LTestValueG).Value) Then
'set color to red in column F
Range(LChangedValue).Interior.ColorIndex = 3
Range(LTestValue).Interior.ColorIndex = 3
' set color to red in column G
Range(LChangedValueG).Interior.ColorIndex = 3
Range(LTestValueG).Interior.ColorIndex = 3
End If
End If
LTestLoop = LTestLoop + 1
Wend

End If
LLoop = LLoop + 1
Wend


End Sub
Reply With Quote
  #2 (permalink)  
Old October 22nd, 2009, 11:12 PM
Registered User
 
Join Date: Oct 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default nevermind "I Got it"

Took out some breaks and and fixed some code and behold "SUCCESS"
Thanks too all anyway
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Difficulties with "web.config" and "ASPNETDB" CFRham BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950 2 July 3rd, 2010 10:19 AM
Error in sample code "Professional Codeigniter" langithitam BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8 5 November 1st, 2009 05:20 AM
How to theme the "Browse" button of "FileUpload" control? varunbwj BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 October 14th, 2009 01:22 AM
Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM
Code not going as planned: "icicle" vs "savedinstancestate" joopthecat BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 3 May 3rd, 2009 03:09 PM



All times are GMT -4. The time now is 01:25 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.