Hi guys,
Could someone help me I can't open MyLangFile variable
see code below:
Could someone help me I can't open MyLangFile variable
see code below:
Code:
Sub OpenLangFile()
Dim myLangCol As String
Dim myPath As String
Dim myFile As String
Dim mySheetname As String
Dim myLangFile As String
myPath = Application.ActiveWorkbook.Path
For Each sht In ActiveWorkbook.Worksheets
Set rng = sht.UsedRange
Set MyRange = rng
For Each MyCol In MyRange.Columns
For Each myCell In MyCol.Cells
'MsgBox ("Address: " & MyCell.Address & Chr(10) & "Value: " & MyCell.Value)
If myCell.Interior.Color = vbBlue Then
If myCell.Font.Color = vbRed Then
myLangCol = MyCol.Cells(1, 1).Text
myPath = Application.ActiveWorkbook.Path
myFile = Left(ThisWorkbook.Name, (InStrRev(ThisWorkbook.Name, ".", -1, vbTextCompare) - 1))
mySheetname = ActiveSheet.Name
myLangFile = myPath & "\" & myFile & "_" & mySheetname & "_" & myLangCol & ".xls"
Set noLangFilen = Workbooks.Open(myLangFile)
'MsgBox myLangFile
'myLangColTxtFilter = MyCol.Cells(1, 1).Text
'MsgBox MyFile
End If
'MsgBox "" & Mycell.Column
'Cells(Mycell.Row, 2).Copy
'Mycell.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
'SkipBlanks:=False, Transpose:=False
End If
Next
Next
Next
End Sub