Home > Software engineering >  Excel the VB programming, expert help answer, thank you!
Excel the VB programming, expert help answer, thank you!

Time:09-15

Shows that under the first: the original form is consists of two blocks, the original form on the part of the title bar of eight lines, fill out section 15 lines, middle empty a line, the part of the header of 3 lines, fill in part accounts for 15 lines, now want to keep only the upper part, don't second half, but the first page after generation generation is normal, the results the second page you have broken the generated form, trouble master how to generate continuous data? Program of some may be useless, not professional, superior to solve trouble, I am a novice, tell me how to modify the, detailed, grateful!
Sub statistical materials ()

Dim As Integer k
K=Sheets (" operating table "). The Range (" c1 "). The Value

Sheets (" on "). Select
Range (Cells (7, 2), Cells (7, 60)). Select
Selection. Copy
Range (Cells (8, 2), Cells (k + 7, 60)). Select
ActiveSheet. Paste
'clear clipboard
Application. CutCopyMode=False
Application.Com mandBars (" Task Pane "). The Visible=False
'convert text
Range (Cells (8, 2), Cells (k + 7, 60)). Select
Selection. Copy
Selection. The PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

Under the Sheets (" "). Select
Range (Cells (7, 2), Cells (7, 60)). Select
Selection. Copy
Range (Cells (8, 2), Cells (k + 7, 60)). Select
ActiveSheet. Paste
'clear clipboard
Application. CutCopyMode=False
Application.Com mandBars (" Task Pane "). The Visible=False
'convert text
Range (Cells (8, 2), Cells (k + 7, 60)). Select
Selection. Copy
Selection. The PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

Sheets (" operating table "). Select
End Sub
Sub to restore the initial ()

'fluctuation form to restore the initial

Dim As Integer k
K=Sheets (" operating table "). The Range (" c1 "). The Value

Sheets (" on "). Select
Range (Cells (8, 2), Cells (k + 7, 60)). Select
Selection. ClearContents
Under the Sheets (" "). Select
Range (Cells (8, 2), Cells (k + 7, 60)). Select
Selection. ClearContents
Sheets (" operating table "). Select

Dim As Integer I
I=Sheets (" operating table "). The Range (" c2 "). The Value
Sheets (" section material list "). Select
Range (Rows (42) and Rows (I)). Select
'Selection. Delete Shift:=xlUp
Selection. ClearContents
ActiveSheet. DrawingObjects. Delete
ActiveSheet. PageSetup. PrintArea="$$1 B: $$41" BD
Sheets (" operating table "). Select



End Sub
Sub and restore the initial ()

'fluctuation form to restore the initial

Dim As Integer k
K=Sheets (" operating table "). The Range (" c1 "). The Value

Sheets (" on "). Select
Range (Cells (8, 2), Cells (k + 7, 60)). Select
Selection. ClearContents
Under the Sheets (" "). Select
Range (Cells (8, 2), Cells (k + 7, 60)). Select
Selection. ClearContents
Sheets (" operating table "). Select

Sheets (" operating table "). Select
End Sub



Sub duplicate section material table template ()
Dim As Integer I
Dim As Integer k

K=Sheets (" operating table "). The Range (" c2 "). The Value

For I=1 To Step 41 k

Sheets (" template "). Select
Rows (" messias "). Select
Selection. Copy
Sheets (" section material list "). Select
Range (Cells (I, 1), Cells (I + 40, 60). Select
ActiveSheet. Paste
'clear clipboard
Application. CutCopyMode=False
Application.Com mandBars (" Task Pane "). The Visible=False

Next
Sheets (" operating table "). Select
End Sub

Sub generated section material list ()



'page 1
Sheets (" on "). Select
Rows (" 8:22). Select
Selection. Copy
Sheets (" section material list "). Select
Rows (" 8:22). Select
ActiveSheet. Paste
'clear clipboard
Application. CutCopyMode=False
Application.Com mandBars (" Task Pane "). The Visible=False

Under the Sheets (" "). Select
Rows (" 8:22). Select
Selection. Copy
Sheets (" section material list "). Select
Rows (" and "). Select
ActiveSheet. Paste

'clear clipboard
Application. CutCopyMode=False
Application.Com mandBars (" Task Pane "). The Visible=False

'on page 2
Dim As Integer I
Dim j As Integer
Dim As Integer k
J=1
K=Sheets (" operating table "). The Range (" c4 "). The Value
For I=23 To Step 15 k
Sheets (" on "). Select
Range (Cells (I, 1), Cells (I + 14, 60)). Select
Selection. Copy
Sheets (" section material list "). Select
Range (Cells (26 * j, I + 1), Cells (26 * I + j + 14, 60)). Select
ActiveSheet. Paste
'clear clipboard
Application. CutCopyMode=False
Application.Com mandBars (" Task Pane "). The Visible=False

Under the Sheets (" "). Select
Range (Cells (I, 1), Cells (I + 14, 60)). Select
Selection. Copy
Sheets (" section material list "). Select
Range (Cells (I + 18 + 26 * j, 1), Cells (I + 32 + 26 * j, 60)). Select
ActiveSheet. Paste
'clear clipboard
Application. CutCopyMode=False
Application.Com mandBars (" Task Pane "). The Visible=False
J=j + 1

Next
Sheets (" section material list "). Select
ActiveSheet. PageSetup. PrintArea="$B: $BD"
Sheets (" operating table "). Select

End Sub

CodePudding user response:

Didn't quite understand your problem, can try to add some breakpoints, step by step implementation see question reason
  •  Tags:  
  • VBA
  • Related