Can't openfile call a variable

elmnas

Board Regular
Joined
Feb 20, 2015
Messages
206
Hi guys,

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
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,216,248
Messages
6,129,702
Members
449,528
Latest member
Paula03

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top