Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default Another Auto Fill variable length column

Greetings:
Am trying to use the following as part of an existing process to copy down
formulas placed in G2 and I2, to variable length columns.

When trying to CALL the Private Sub, I get Error messages as detailed under
each CALL line:

' Copy formulas in G2 and I2 down thru to last used Row

Call Worksheet_Change
' Creates Compile Error: Argument not Optional

Call Worksheet_Change(ByVal Target As Range)
' Creates Compile Error: List seperator or )

End Sub

The following is the code I got from this group.
I understand what it is supposed to do. Hopefully it works OK when the CALL
problem is resolved.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim LRow As Long
If Target.Column = 1 Then
LRow = Cells(Rows.Count, 1).End(x1Up).Row
Application.EnableEvents = False
Range("G2").AutoFill Destination:=Range("G3:G" & LRow)
Range("I2").AutoFill Destination:=Range("I3:I" & LRow)
Application.EnableEvents = True
End If

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default Another Auto Fill variable length column

Please ignore this post. I'm trying to tackle it a different way.


"BEEJAY" wrote:

Greetings:
Am trying to use the following as part of an existing process to copy down
formulas placed in G2 and I2, to variable length columns.

When trying to CALL the Private Sub, I get Error messages as detailed under
each CALL line:

' Copy formulas in G2 and I2 down thru to last used Row

Call Worksheet_Change
' Creates Compile Error: Argument not Optional

Call Worksheet_Change(ByVal Target As Range)
' Creates Compile Error: List seperator or )

End Sub

The following is the code I got from this group.
I understand what it is supposed to do. Hopefully it works OK when the CALL
problem is resolved.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim LRow As Long
If Target.Column = 1 Then
LRow = Cells(Rows.Count, 1).End(x1Up).Row
Application.EnableEvents = False
Range("G2").AutoFill Destination:=Range("G3:G" & LRow)
Range("I2").AutoFill Destination:=Range("I3:I" & LRow)
Application.EnableEvents = True
End If

End Sub

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
Autosum a variable column length using VB sid[_3_] Excel Programming 4 May 17th 06 04:00 PM
Sum a Column of Variable length Chris G Excel Discussion (Misc queries) 4 November 7th 05 12:25 PM
Sum a column of variable length? Brian Excel Discussion (Misc queries) 5 February 3rd 05 02:26 PM
Continuing Difficulties W/ Sum For Variable-length Column Chuckles123[_13_] Excel Programming 0 October 5th 04 04:31 AM
Averaging a variable length column Doug[_10_] Excel Programming 1 June 22nd 04 07:48 PM


All times are GMT +1. The time now is 12:01 AM.

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"