Thread: Error
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jen_T Jen_T is offline
external usenet poster
 
Posts: 66
Default Error

Sorry one more item; this is the error I receive:
Runtime error '-2147417848 (80010108)':
Method'_Default' of object 'Range'failed

"Simon Lloyd" wrote:


Jen_T where does the code fall down and what is the error number?, can
you explain a little of what you are trying to achieve with this code?,
i do notice that not all your variables have been declared, there may be
a problem there.

Jen_T;295683 Wrote:
Sorry about that meant to do that.. Thank you

Here the portion of the code I receive the error

Code:
--------------------

Private Sub writeToClean(i As Long, settings As clsSettings, rawData As
clsRawData)

'Find ith row in raw. Do it by calling a function in rawData that
returns a range
Dim clnWrkSht As Worksheet
Set clnWrkSht =
settings.getSettingsWrkBk.Worksheets(settings.getC leanWrkSht)

Dim headerRange As Range, ithRange As Range
Set headerRange = rawData.get_ith_row(0)
Set ithRange = rawData.get_ith_row(i)

Dim varHeaderRange As Variant, numHeaderRange As Long
varHeaderRange = WorksheetFunction.Transpose(headerRange)
numHeaderRange = WorksheetFunction.CountA(varHeaderRange)

Dim cols As Variant, extract, multiVal, freeFormAllowed
Dim possibleVal As Range
cols = WorksheetFunction.Transpose(settings.getColumn)
extract = WorksheetFunction.Transpose(settings.getExtract)
multiVal = WorksheetFunction.Transpose(settings.getMultipleVa lue)
freeFormAllowed = WorksheetFunction.Transpose(settings.getFreeFormAl lowed)
Set possibleVal = settings.getPossibleValues

Dim clnHeadings As Variant
clnHeadings = settings.getHeadings

Dim k As Long, j As Long, clnHeadingCntr As Long, a As Long, b As Long,
c As Long
Dim PosValAt_i As Range, PosValAt_i_Array As Variant
clnHeadingCntr = LBound(clnHeadings)

For k = LBound(varHeaderRange) To (LBound(varHeaderRange) +
numHeaderRange - 1)
If cols(k) = varHeaderRange(k, 1) Then
If (extract(k) = "Y") Then
If (multiVal(k) = "N") Then
clnHeadingCntr = clnHeadingCntr + 1
clnWrkSht.Cells(i + 1, clnHeadingCntr) =
ithRange.Cells(1, k)
Else
Set PosValAt_i = possibleVal.Rows(k)
b = WorksheetFunction.CountA(PosValAt_i)
PosValAt_i_Array = Range(possibleVal.Cells(k, 1),
possibleVal.Cells(k, b))
For a = 1 To rawData.getNumOfRowsAt_i(i)
If (Not IsEmpty(ithRange.Cells(a, k))) And
ithRange.Cells(a, k) < "" Then
c = -1
On Error Resume Next
c =
WorksheetFunction.Match(Trim(ithRange.Cells(a, k)), PosValAt_i_Array, False)
On Error GoTo 0
If c = -1 Then
If freeFormAllowed(k) = "N" Then
MsgBox "Something is wrong"
Stop

--------------------



"Chip Pearson" wrote:


Post the code that is causing the problem.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
'www.cpearson.com' (http://www.cpearson.com)
(email on web site)

On Fri, 3 Apr 2009 07:39:01 -0700, Jen_T
wrote:

I was wondering if anyone knows what this error means when I run a

macro i
get this error:
Method 'Default' of object 'Range' failed



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=82532