Inserting lines, and contents in multiple sheets

C

Chucklesss

I have a 13 page workbook. I am trying to write a macro that will let m
insert a line in each sheet, in a predefined location, then accep
input and copy it to each sheet
 
B

Bill Kuunders

If the lines are to be added in the same position in each sheet
you won't need a macro.
Just select all sheets at once (click onto each tab while holding control
button).
Each tab will become white.
Insert a row and enter the data on the top sheet.

Regards
Bill K
 
C

Chucklesss

Thanks Bill;

I am trying to "idiot" proof the workbook, so that users will b
prompted for their input (2 values) and these will then be entered int
all of the sheets.

The "master" sheet is where I want the input to go, the "slave" sheet
have been written to input values from the master.

Thanks for your help
 
C

Chucklesss

Thanks Bill;

I am trying to "idiot" proof the workbook, so that users will b
prompted for their input (2 values) and these will then be entered int
all of the sheets.

The "master" sheet is where I want the input to go, the "slave" sheet
have been written to input values from the master.

Thanks for your help
 
D

Dave Peterson

You could get the input by asking:

Option Explicit
Sub testme03()

Dim myVal1 As Variant
Dim myVal2 As Variant
Dim myRowToInsertBefore As Long
Dim wks As Worksheet

myRowToInsertBefore = 13

myVal1 = InputBox(Prompt:="what's the first value?")
If Trim(myVal1) = "" Then
MsgBox "Quitting"
Exit Sub
End If

myVal2 = InputBox(Prompt:="what's the second value?")
If Trim(myVal2) = "" Then
MsgBox "Quitting"
Exit Sub
End If

For Each wks In ActiveWorkbook.Worksheets
With wks
.Rows(myRowToInsertBefore).Insert
.Cells(myRowToInsertBefore, "a").Value = myVal1
.Cells(myRowToInsertBefore, "B").Value = myVal2
End With
Next wks

End Sub

In fact, you may want to build a small userfrom so that you could get all the
information at once.
 
Top