-
Jun 4th, 2019, 08:43 PM
#1
Thread Starter
New Member
Doubt with Worbooks
I need to open a file which is listed in my sheet. I've listed many files in a column, all files in the same folder, I need to open first one, copy some cellls, close file. Then open second file in the list, copy and paste some cells, and then close it.
I tried with
Sub firstt()
Workbooks("Worksheets("Hoja1").Range("A2").Value").Worksheets("Hello").Range("A1:K30").Copy
End Sub
Because in my main Book in worksheet Hoja1 in the cell A2 I have the name of the file I need to open, so my problem is in this part:
Workbooks("Worksheets("Hoja1").Range("A2").Value")
This code is not getting the name of the file I have listed in A2.
I need something to put inside Workbooks(?) in order to use the file I have listed in A2
Thanks in advance
-
Jun 5th, 2019, 12:53 AM
#2
Re: Doubt with Worbooks
to read a Cell Value try this
Code:
Imports Microsoft.Office.Interop.Excel
Imports Microsoft.Office.Interop
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim Path As String = "E:\a9.xlsx" 'Datei mit Pfadangabe
Dim Excel As ApplicationClass = New ApplicationClass
Dim WorkBook As Workbook = Excel.Workbooks.Open(Path)
Dim WorkSheets As Sheets = WorkBook.Sheets
Dim WorkSheet As Worksheet = CType(WorkSheets(1), Excel.Worksheet)
Dim cell As String = CStr(WorkSheet.Range("A2").Value)
TextBox1.Text = cell
Excel.Application.Quit()
End Sub
to hunt a species to extinction is not logical !
since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.
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
|