LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Filling down a selection

Wally,

Small correction...
Delete the "Exit Sub" line - 5th code line from bottom.

Jim Cone


"Jim Cone" wrote in message
...
Wally,
This should get you started...
'----------------------------------
Sub DoNotRespondToUnsolicitedAdvertising()
'Jim Cone - December 27, 2004
Dim rngStart As Excel.Range
Dim rngLast As Excel.Range
Dim lngStartNum As Long
'Assumes correct cell is selected and a
'name is filled in to the left.
lngStartNum = Val(VBA.InputBox(vbCr & "Enter the quantity", _
" Wally's List", "Be reasonable"))
If Val(lngStartNum) 2 Then
Set rngStart = ActiveCell
rngStart.Value = lngStartNum
rngStart(2, 1).Value = lngStartNum - 1
Else
GoTo QuitHere
End If
Set rngLast = rngStart(lngStartNum, 1)
Range(rngStart, rngStart(2, 1)).AutoFill _
Range(rngStart, rngLast)
Range(rngStart, rngLast).Offset(0, -1).Value = _
rngStart(1, 0).Value
Exit Sub '*** Delete this line
QuitHe
Set rngStart = Nothing
Set rngLast = Nothing
End Sub
'--------------------------
Regards,
Jim Cone
San Francisco, USA

 
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
Automatically filling a cell from a worksheet based on a selection Pbrent Excel Worksheet Functions 2 May 14th 10 03:39 PM
Copy Selection - Transpose Selection - Delete Selection Uninvisible Excel Discussion (Misc queries) 2 October 23rd 07 04:18 PM
filling information from one cell and filling another. Dianne Excel Worksheet Functions 1 August 15th 05 08:14 PM
Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue. jonH Excel Programming 3 June 7th 04 09:13 PM
Filling multiple cells based on 1 combo box selection Serrena Carter Excel Programming 1 August 30th 03 02:14 PM


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