Home > Software engineering >  Vb operation EXCEL copy line conditions in table 2
Vb operation EXCEL copy line conditions in table 2

Time:10-06



Vb how to operate the excel, judge F listed in table 1, whether it is "work",
If it's "work",
In turn the entire line of shear to table 2 for code! Thank you very much!

CodePudding user response:

VBA
 
Sub veimi ()
Dim As Integer p
P=1
For I=1 To 20
If Cells (I, 6)="work" Then
Sheet1. Rows (I). Copy Destination:=Sheet2. Rows (p)
P=p + 1
End the If
Next I
End Sub

CodePudding user response:

reference 1st floor veimi response:
VBA
 
Sub veimi ()
Dim As Integer p
P=1
For I=1 To 20
If Cells (I, 6)="work" Then
Sheet1. Rows (I). Copy Destination:=Sheet2. Rows (p)
P=p + 1
End the If
Next I
End Sub

+ 1

CodePudding user response:

Could you tell me how to write in VB? Not VBA, thank you!

refer to the second floor xxxxing response:
Quote: refer to 1st floor veimi response:

VBA
 
Sub veimi ()
Dim As Integer p
P=1
For I=1 To 20
If Cells (I, 6)="work" Then
Sheet1. Rows (I). Copy Destination:=Sheet2. Rows (p)
P=p + 1
End the If
Next I
End Sub

+ 1

CodePudding user response:

http://wenku.baidu.com/link? Url=58 scpwdcugwnhwponkitwclwscxq6b3i1afytdcxhwzj_qvez9sq7tcqioj4ccapzfb_ lz1rf3ly8ojbszhwefakdi56z X7G6PnULi86-2 -

CodePudding user response:

Need to refer to office

CodePudding user response:

Dim xlsheet As excel. The Worksheet 'definition of excel object
Dim Exl As excel. Application 'definition of excel object
Dim myworkbook As excel. The Workbook
The Set Exl=CreateObject (" Excel. Application ")
The Set myworkbook=Exl. Workbooks. Open (" d: \ a.x ls ")
Exl. Visible=False
The Set xlsheet=myworkbook. Worksheets (1)
"add xlsheet here. Cells (? 6) statement "
Myworkbook. Close (True) 'Close the workbook
Exl. Quit 'end EXCEL object
The Set Exl=Nothing

CodePudding user response:

1/f, nice,

CodePudding user response:

6th floor is a positive solution, and then in the reference load a thing is perfect
  • Related