Closed Thread
Results 1 to 3 of 3

VBA Insert formatted rows + a copy of itself

  1. #1
    Registered User
    Join Date
    10-19-2020
    Location
    Canada
    MS-Off Ver
    2019
    Posts
    2

    VBA Insert formatted rows + a copy of itself

    I would like to have rows dynamically inserted underneath a formatted row (row 6 for example) based off an inputted value in a cell (F:6). Then a copy of the formatted row would be placed after that so another value can be inserted into the next F:# cell and rows would appear below that, etc.

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$F$6" And IsNumeric(Target) Then
    Rows(7).Resize(Target.Value).Insert
    '...
    End If
    End Sub

    (However this code is too hardcoded for my needs)

    example : row 6 cell F:6 user puts in a '3' So 3 rows (7,8,9) get put underneath with row 10 being a copy of the original cell. Then in F:10 a user puts 2 so 2 rows are placed underneath, etc....


    Can this be done? it would be nice to have some pre formatting applied to those inserted cells. even if what is inserted is a pre-made row from another worksheet.

    Any help or direction is greatly appreciated.
    Last edited by lhunt0194; 10-26-2020 at 03:11 PM.

  2. #2
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: VBA Insert formatted rows + a copy of itself

    you posted a dup. a mod will delete one:

    https://www.excelforum.com/excel-pro...of-istelf.html

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,860

    Re: VBA Insert formatted rows + a copy of itself

    Administrative Note:

    Welcome to the forum.

    Unfortunately, this is a duplicate thread, and you are allowed only ONE thread per issue here.

    Please see Forum Rule #5 about thread duplication.

    I am closing this thread, but you may continue here in the original thread:https://www.excelforum.com/excel-pro...of-istelf.html
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Copy and Paste Conditionally formatted rows
    By theTaoJones in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-17-2019, 07:32 AM
  2. Need multiple macro buttons to insert new, formatted rows
    By msmetal in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-09-2014, 12:05 PM
  3. [SOLVED] Copy conditionally formatted non-adjacent rows
    By Thistledown in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-12-2014, 09:31 AM
  4. [SOLVED] Need help to easily copy rows that contain a formatted date
    By cpeaches in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-22-2013, 09:05 AM
  5. Insert rows via values of formatted cell
    By christya24 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-05-2009, 10:52 AM
  6. Macro to insert formatted rows
    By oneblueaugust in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-24-2009, 05:05 PM
  7. Copy rows formatted and with same hidden colums
    By z00misen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-20-2006, 11:22 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1