-
Aug 27th, 2015, 10:29 PM
#1
Thread Starter
New Member
SOLVED! - [Excel - Office 2007] EXACT intrinsic function is causing "Sub or Function
Hi, I am trying to write a simple macro (subroutine) in VB for Excel, Office 2007. I keep getting Sub or Function not defined error. I presume it is not a syntax error on my part (please let me know if it is something this simple). Is there some library I am supposed to include from the References dialog box? In any case here is the code:
Sub SubTable()
rri = 251
For rd = 24 To 102 'Row for Domaiin category
Windows("Initial Category List - Final Version.xlsx").Activate
od = Cells(rd, 4).Value 'old category name
nw = Cells(rd, 8).Value 'new category name
Windows("Combined product ListUpdate1Macro.xlsm").Activate
For rr = rri To 1665 'Row in the Range
If EXACT(od, Cells(rr, 8).Value) = TRUE Then '<-- This is the row causing the problem
Let Cells(rr, 8).Value = nw
Else
rri = rr
GoTo nrd
End If
nrd: Next rd
MsgBox "At the end rri should = 1665, actual value at end =" & rri
Return
End Sub
Last edited by dynamo2000; Aug 29th, 2015 at 08:40 PM.
-
Aug 28th, 2015, 02:00 AM
#2
Member
Re: [Excel - Office 2007] EXACT intrinsic function is causing "Sub or Function not d
hi dynomo
try..
Code:
Set wb1 = Workbooks("Initial Category List - Final Version.xlsx")
Set wb2 = Workbooks("Combined product ListUpdate1Macro.xlsm")
Rri = 251
With wb1.Sheet1
For rd = 24 To 102 'Row for Domaiin category
od = .Cells(rd, 4).Value 'old category name
nw = .Cells(rd, 8).Value 'new category name
With wb2.Sheet1
For rr = Rri To 1665 'Row in the Range
If od = .Cells(rr, 8).Value Then '<-- This is the row causing the problem
.Cells(rr, 8).Value = nw
Else
Rri = rr
End If
Next rr
End With
Next rd
End With
MsgBox "At the end rri should = 1665, actual value at end =" & Rri
-
Aug 28th, 2015, 04:11 AM
#3
Re: [Excel - Office 2007] EXACT intrinsic function is causing "Sub or Function not d
to clarify
EXCACT is a worksheet function
generally worksheet functions are specified like
Code:
if worksheetfunction.exact(str1,str2) then
but in the case of exact (and some of the other worksheet functions), it is not available to VBA, as VBA has other methods to achieve the same result
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Aug 29th, 2015, 08:43 PM
#4
Thread Starter
New Member
Re: SOLVED! - [Excel - Office 2007] EXACT intrinsic function is causing "Sub or Func
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|