Home > Software engineering >  Use vba, open my computer d dish WDXX folder called hi555 Excel, below and copy the sheet name is aa
Use vba, open my computer d dish WDXX folder called hi555 Excel, below and copy the sheet name is aa

Time:11-22

Use vba, open my computer d dish WDXX folder called hi555 Excel, below and copy the sheet name is aa that piece of sheet, novice, thank you

CodePudding user response:

Can only copy its content, other don't do any operation, don't show the operation of the open the Excel

CodePudding user response:

Excuse me, is the job of the name with aa table

CodePudding user response:

Write well, code is as follows:
 
Sub test ()
Dim wb As Workbook
The Set wb=Application. Workbooks. Open (" d: \ WDXX \ hi555 XLSX ")

Dim SHT As Worksheet
For Each SHT In wb. Worksheets
If InStr (SHT) Name, "aa") & gt; 0 Then
SHT. Cells. Copy

Dim sht2 As Worksheet
The Set sht2=ThisWorkbook. Sheets. The Add (After:=ThisWorkbook. Sheets (ThisWorkbook. Sheets. Count))

Sht2. Name=SHT. Name
Sht2. Cells. PasteSpecial

Application. CutCopyMode=False
End the If
Next

Wb. Close
End Sub

Run the example:


Download address:
Link: https://pan.baidu.com/s/1zERGOXPclUPHNAifLQgtYA
The extracted code: j0de

CodePudding user response:

CodePudding user response:

What code heavy start, just use the means of recording macros, operating your want, then slowly to optimize and measure program. I do it.
  •  Tags:  
  • VBA