Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() I have an Excel Spreadsheet with rows of data in several categories. Each category is separated by two blank rows. In column G, in the blank cell immediately above each category, I write the category heading - a process I have already automated using the macro Copy_Title. To save having to manually run down column G and run Copy_Title in the appropriate cells, I am now trying to write another macro which will automate this task. However, my efforts have not achieved success so far: Sub Copy_Title_Auto() Range("G2").Select Dim LastRow As Long Dim x As Long Dim y As Long y = ActiveCell.Column LastRow = Cells(Rows.Count, ActiveCell.Column).End(xlUp).Row Application.ScreenUpdating = False For x = LastRow To 2 Step -1 If Cells(x, y).Value = "" And Cells(x - 1, y).Value = "" Then With Cells(x, y) Call Copy_Title End With End If Next x Application.ScreenUpdating = True End Sub Can anyone help please? Many thanks. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Refresh an Access Query using VBA code in Excel | Excel Programming | |||
VB Code or Excel macro to run Query/Import on Access file | Excel Programming | |||
VB macro code for SQL Query | Excel Programming | |||
Excel Query - Code problem | Excel Programming | |||
Code to run an Access query from Excel | Excel Programming |