Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default 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?


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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?


.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert 3 blank rows wherever the date changes in column???? malycom Excel Discussion (Misc queries) 4 May 21st 09 04:03 PM
insert a blank column between each column in a data file Holly Excel Discussion (Misc queries) 1 October 31st 07 07:04 PM
insert a blank row after data changes in a column cyndi Excel Discussion (Misc queries) 2 October 24th 05 02:46 PM
Insert Blank Column every 9 Columns Nigel Bennett Excel Programming 2 March 15th 05 04:24 AM
When sorting info in columns, can I make it insert blank line bet. nanalehew Excel Worksheet Functions 2 March 12th 05 04:36 PM


All times are GMT +1. The time now is 03:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"