Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Range Definition

I am trying to fill every column for B to whatever with "test".
I use following function to define the range. In this case Last_Column
= 12

Function Last_Column(My_Range As Range) As Long

Last_Column = Application.WorksheetFunction.CountA(My_Range)

End Function

Then I am using the Sub

Sub testa()

For j = 2 To Last_Column(Sheets("test").Rows("1:1"))

Sheets("test").Range(j & "2").Value = "test"

Next j

End Sub

Obvioysly I am not well defining the range. I guess I go wrong on
Range(j & "2").Value

Sorry to be so dumb/ignorant
and thanks for the help/merry xmas

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Range Definition

Found it
Sheets("test").Cells(i, j).Value = "test"
Tks
Dan

On Dec 15, 11:12 am, wrote:
I am trying to fill every column for B to whatever with "test".
I use following function to define the range. In this case Last_Column
= 12

Function Last_Column(My_Range As Range) As Long

Last_Column = Application.WorksheetFunction.CountA(My_Range)

End Function

Then I am using the Sub

Sub testa()

For j = 2 To Last_Column(Sheets("test").Rows("1:1"))

Sheets("test").Range(j & "2").Value = "test"

Next j

End Sub

Obvioysly I am not well defining the range. I guess I go wrong on
Range(j & "2").Value

Sorry to be so dumb/ignorant
and thanks for the help/merry xmas


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
Using Address in Range Definition?? Don G Excel Programming 4 April 1st 06 01:18 AM
definition of the range containing content Martin Excel Programming 2 November 22nd 05 01:35 PM
Range Definition in Macro ? Baapi Excel Programming 1 September 23rd 05 12:08 AM
How come this range definition is invalid? keepITcool Excel Programming 1 June 21st 04 07:15 PM
variable range definition jmp Excel Programming 2 May 6th 04 11:06 PM


All times are GMT +1. The time now is 10:23 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"