SirProperJob
New Member
- Joined
- Feb 15, 2013
- Messages
- 5
Hi,
I'm having problems with an error showing when I try to assign a value to a string variable, saying that's an invalid procedure, when I haven't even called one! It works ok if i step through the code, but if i try to run the whole lot, the error keeps coming up. My code is as below:
The error occurs when I try to assign the value Right(Range("A1").Value, Len(Range("A1").Value) - 28).Value to strCry.
Any ideas as to why this might be happening? Later on in the code i have assigned similar values to other variables with no problems.
I'm having problems with an error showing when I try to assign a value to a string variable, saying that's an invalid procedure, when I haven't even called one! It works ok if i step through the code, but if i try to run the whole lot, the error keeps coming up. My code is as below:
Code:
Sub DanoneExtract()
Dim wbOpen, wbTemp As Workbook
Dim iRow, iUnits, iSheets, x, c, ws As Integer
Dim strExtension, strCry, strCat, strBO, strBrand, strPL, strPriceSeg, strCal, strCarb, strWS, strFl, strPackMat, strPackType, strPackSize, strGeoScope, strChan As String
Dim dblVolShare, dblTotVol, dblVol, dblVal As Double
Const strPath As String = "G:\EDIT\REPORTS\SINGLE CLIENT REPORTS\Danone\2013\00_Project Management\Value Methodology\Suzanna\Dummy Data_Template Test\"
Application.ScreenUpdating = False
Application.DisplayAlerts = False
ChDir strPath
strExtension = Dir(strPath & "*.xls*")
Set wbTemp = Workbooks.Open("G:\EDIT\REPORTS\SINGLE CLIENT REPORTS\Danone\2013\00_Project Management\Value Methodology\Suzanna\DanoneUploadTemplate.xlsx")
Do While strExtension <> ""
Set wbOpen = Workbooks.Open(strPath & strExtension)
wbOpen.Worksheets(1).Activate
strCry = Right(Range("A1").Value, Len(Range("A1").Value) - 28).Value
iRow = 2
iSheets = wbOpen.Worksheets.Count
The error occurs when I try to assign the value Right(Range("A1").Value, Len(Range("A1").Value) - 28).Value to strCry.
Any ideas as to why this might be happening? Later on in the code i have assigned similar values to other variables with no problems.
Last edited: