View Single Post
 
Old 06-17-2021, 02:31 AM
Urraco Urraco is offline Windows 8 Office 2016
Advanced Beginner
 
Join Date: Apr 2018
Posts: 30
Urraco is on a distinguished road
Default

Hi again

I would like to modify your script below in such a way that the even numbers (blue cells) to be generated in the first empty row, as in the example below..can be done?
Thank you



Quote:
Originally Posted by rollis13 View Post
Then try with this macro:
Code:
Option Explicit
Sub test()
    Dim i      As Long
    Dim x      As Long
    Dim col    As Long
    i = 2
    col = Cells(1, Cells.Columns.Count).End(xlToLeft).Column    'use if there is no data after the last used column in row 1
    'col = Cells(1, 1).End(xlToRight).Column    'use if there are no empty columns before the last used in row 1
    Do Until Cells(i, 1) = ""
        For x = 1 To col
            Cells(i, col * 2 - x + 1) = Cells(i, x) + 1
        Next x
        i = i + 1
    Loop
End Sub
Attached Images
File Type: jpg [1]06-17-2021.jpg (17.3 KB, 19 views)
Attached Files
File Type: xlsx Book2.xlsx (8.7 KB, 8 views)
Reply With Quote