Inserting lines, and contents in multiple sheets

  • Thread starter Thread starter Chucklesss
  • Start date Start date
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
 
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
 
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
 
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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top