Is it possible to insert rows based on criteria?

isaacv22

New Member
Joined
Sep 30, 2021
Messages
48
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm currently looking to see if it's possible to have a spreadsheet automatically insert (x) rows below based on answering a question?

For instances while filling a cell it'll ask me if this a multi track conveyor y or n?

If Y then it'd ask how many tracks? I'd be able to input a number and it'd add that many rows below.

Is this possible?

Thanks,

Isaac Vasquez
 
You haven't answered Joe's question yet, please do so.
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
How is this question different than what you asked here?
That's a mistake on my part, I'm currently working on this spreadsheet with another one of my collogues and must've posted the question prior to myself, as we're using my computer for this project.
 
Upvote 0
Ok, I have merged both threads as we do not allow duplicate threads.
How about
VBA Code:
Sub isaacv()
   Dim Rws As Variant
  
   Rws = InputBox("How many rows do you want?")
   If Rws = "" Then Exit Sub
   If Rws > 1 Then
      ActiveCell.Offset(1).Resize(Rws - 1).EntireRow.Insert
      With Range("C" & ActiveCell.Row).Resize(Rws)
         .Offset(, -1).Resize(, 3).FillDown
         .Value = Evaluate("""Conveyor "" & row(1:" & Rws & ")")
      End With
   End If
End Sub
 
Last edited:
Upvote 0
Ok, I have merged both threads as we do not allow duplicate threads.
How about
VBA Code:
Sub isaacv()
   Dim Rws As Variant
 
   Rws = InputBox("How many rows do you want?")
   If Rws = "" Then Exit Sub
   If Rws > 1 Then
      ActiveCell.Offset(1).Resize(Rws - 1).EntireRow.Insert
      With Range("C" & ActiveCell.Row).Resize(Rws)
         .Offset(, -1).Resize(, 3).FillDown
         .Value = Evaluate("""Conveyor "" & row(1:" & Rws & ")")
      End With
   End If
End Sub
Hello Fluff,

Thanks for combining both threads. To further explain I would like the highlighted cells to be able to be copied down to the amount of inserted cells. So if I select cell C5 then push Multiple Tracks Button on top, and input 10 rows. Would it be possible to have the cell to the left of the active cell (in this case A5) and the cell to the right of the active cell (F5) be copied down to the inserted cells based on the x amount of rows inputted?

SAP Autofill Ver_3.2.xlsm
ACFH
1
2ConveyorTrackMaster TagTrack Length
4Conveyor 11FXHA03VAJ
5Conveyor 21XTFJKLXCR
62
73
8Conveyor 31WHH89YHRY
9
10
11
12
13
14
15
16
Formula Sheet
Cells with Data Validation
CellAllowCriteria
F4:F16List=QR_Validation
 
Upvote 0
How about
VBA Code:
Sub isaacv()
   Dim Rws As Variant
   
   Rws = InputBox("How many rows do you want?")
   If Rws = "" Then Exit Sub
   If Rws > 1 Then
      ActiveCell.Offset(1).Resize(Rws - 1).EntireRow.Insert
      With Range("C" & ActiveCell.Row).Resize(Rws)
         .Offset(, -2).FillDown
         .Offset(, 3).FillDown
         .Value = Evaluate("""Conveyor "" & row(1:" & Rws & ")")
      End With
   End If
End Sub
 
Upvote 0
Solution
How about
VBA Code:
Sub isaacv()
   Dim Rws As Variant
  
   Rws = InputBox("How many rows do you want?")
   If Rws = "" Then Exit Sub
   If Rws > 1 Then
      ActiveCell.Offset(1).Resize(Rws - 1).EntireRow.Insert
      With Range("C" & ActiveCell.Row).Resize(Rws)
         .Offset(, -2).FillDown
         .Offset(, 3).FillDown
         .Value = Evaluate("""Conveyor "" & row(1:" & Rws & ")")
      End With
   End If
End Sub
Worked like a charm, thank you very much! I greatly appreciate your help!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,915
Messages
6,122,214
Members
449,074
Latest member
cancansova

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top