![]() |
Insert a blank Column Every 9 Columns
I am looking for some help with inserting a blank column every 9 columns, the count needs to start from and include Column D and then every 9 columns insert a blank column unless the column is allready there, I have code that checks for a blank column and resizes it, I just need the portion to insert the blank column if it doesn't exist thanks Nigel |
Insert a blank Column Every 9 Columns
"Nigel Bennett" wrote in message
... I am looking for some help with inserting a blank column every 9 columns, the count needs to start from and include Column D and then every 9 columns insert a blank column unless the column is allready there, The column is always there, all the way up to 256. What exactly do you mean? |
Insert a blank Column Every 9 Columns
Hi
Try Sub InsertBlankColumns() Dim wStart% Dim wStep% Dim iCol% wStart = 4 wStep = 9 iCol = wStart Do While iCol < 256 'check if iCol is blank 'if this means that there is not data in the cells If Application.WorksheetFunction.CountA(Sheet1.Column s(iCol)) < 0 Then Sheet1.Columns(iCol).EntireColumn.Insert End If iCol = iCol + wStep Loop End Sub "Nigel Bennett" wrote: I am looking for some help with inserting a blank column every 9 columns, the count needs to start from and include Column D and then every 9 columns insert a blank column unless the column is allready there, I have code that checks for a blank column and resizes it, I just need the portion to insert the blank column if it doesn't exist thanks Nigel |
Insert a blank Column Every 9 Columns
Sorry I wasn't more specific, if the column is blank
ignore it otherwise insert the blank column, I already have code that will let me know if the column is blank, I am looking for something that would insert a column every 9 columns starting from column d -----Original Message----- "Nigel Bennett" wrote in message ... I am looking for some help with inserting a blank column every 9 columns, the count needs to start from and include Column D and then every 9 columns insert a blank column unless the column is allready there, The column is always there, all the way up to 256. What exactly do you mean? . |
Insert a blank Column Every 9 Columns
This should do it then For i = 256 To 4 Step -9 If Application.Count(Columns(i)) 0 Then Columns(i).EntireColumn.Insert End If Next i RP (remove nothere from the email address if mailing direct) "Nigel Bennett" wrote in message ... Sorry I wasn't more specific, if the column is blank ignore it otherwise insert the blank column, I already have code that will let me know if the column is blank, I am looking for something that would insert a column every 9 columns starting from column d -----Original Message----- "Nigel Bennett" wrote in message ... I am looking for some help with inserting a blank column every 9 columns, the count needs to start from and include Column D and then every 9 columns insert a blank column unless the column is allready there, The column is always there, all the way up to 256. What exactly do you mean? . |
All times are GMT +1. The time now is 11:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com