Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Finding next empty empty cell in a range of columns

I have been through the posts here and can not find exactly the same senario
as I want to perform.

I have a spreadsheet where data will be held in columns for people. Each
person has its own column. I want to be able to place a persons name in the
heading of each column. So I am trying to find the next empty column in row 3
to place the name.

The code I have used but does not appear to work is

NextCol = Application.WorksheetFunction.CountA(Range("D3:W3" )) + 1

It always returns a value of 1.

This code is in a commandButton(Click) proceedure. I thought it would look
at the range and give me the next column free as a response?



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Finding next empty empty cell in a range of columns

maybe...

Dim NextCol as long

with activesheet
nextcol = .cells(3,.columns.count).end(xltoleft).column + 1
end with

But the only way I would think your code wouldn't work is if the code was
looking at the wrong sheet:

NextCol _
= Application.WorksheetFunction.CountA(worksheets("S heet99").Range("D3:W3")) + 1

UncleBun wrote:

I have been through the posts here and can not find exactly the same senario
as I want to perform.

I have a spreadsheet where data will be held in columns for people. Each
person has its own column. I want to be able to place a persons name in the
heading of each column. So I am trying to find the next empty column in row 3
to place the name.

The code I have used but does not appear to work is

NextCol = Application.WorksheetFunction.CountA(Range("D3:W3" )) + 1

It always returns a value of 1.

This code is in a commandButton(Click) proceedure. I thought it would look
at the range and give me the next column free as a response?


--

Dave Peterson
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
Finding next available empty cell in a row Wendy Excel Programming 3 January 14th 06 12:02 AM
Finding the first empty cell in a column Tegger Excel Programming 5 January 7th 06 01:12 AM
automatically finding the first empty cell Markus Scheible Excel Programming 4 January 17th 05 03:32 PM
Finding first (end of range) empty cell Alesandro Senerchia Excel Programming 4 May 20th 04 02:36 AM
Finding the next empty cell. Unknown_User[_3_] Excel Programming 10 May 19th 04 02:45 PM


All times are GMT +1. The time now is 11:09 AM.

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

About Us

"It's about Microsoft Excel"