Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 04-18-2024, 02:45 AM
vivka vivka is offline A code to add fresh row after each odd row Windows 7 64bit A code to add fresh row after each odd row Office 2016
Expert
 
Join Date: Jul 2023
Posts: 305
vivka is on a distinguished road
Default

Hi, Capitala! The code is quite simple:
Code:
Sub Tbl_Add_Rows()
'In the selected tbl, insert a row after each odd row.

Dim LastRow As Integer
    Application.ScreenUpdating = False
    LastRow = selection.Tables(1).rows.count
    If LastRow Mod 2 = 0 Then
        LastRow = LastRow
    Else: LastRow = LastRow - 1
    End If
    For i = LastRow To 2 Step -2
        selection.Tables(1).rows(i).Select
        With selection.Tables(1).rows(i)
            selection.InsertRowsAbove 1
        End With
    Next i
Application.ScreenUpdating = True
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
I want to start fresh wweissborn OneNote 0 04-10-2024 03:44 PM
fresh install - excel and outlook won't appear in defaults gtr851 Office 0 11-30-2020 06:41 PM
Fresh reload of Outlook 2007 doesn't allow me to "delete" messages in my IN box Richardbye Outlook 0 05-20-2018 11:30 PM
2013 issues opening files after fresh instal dversion1 Office 0 10-06-2013 09:38 AM
Generating Fresh Copies Of an Excel Document callumwk Excel 2 04-09-2012 06:13 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:57 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft