Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Fill Down VBA help please

Imagine in Excel you have A1 = 1

A6 = 2

A11 = 3

This is for this weeks data, next week value 2 could be in A7 or A10
or A12 etc.

I want to have the flexibility to fill down from e.g. this week from
A1 to A5 and fill A6 to A10 will a 2 etc.

How can I do this? I can't seem to get the range flexibility, thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Fill Down VBA help please

Try this idea
Sub fillnumbersmod()
j = 1
For i = 1 To 12 Step 5
Cells(i, "a").Resize(5) = j
j = j + 1
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

wrote in message
...
Imagine in Excel you have A1 = 1

A6 = 2

A11 = 3

This is for this weeks data, next week value 2 could be in A7 or A10
or A12 etc.

I want to have the flexibility to fill down from e.g. this week from
A1 to A5 and fill A6 to A10 will a 2 etc.

How can I do this? I can't seem to get the range flexibility, thanks.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Fill Down VBA help please

One interpretation

Assume the first value is in A1 and other values across the range A1:A500
and you want to stop filling at A500.


Sub fillcells()
Dim rng As Range
Range("A501").Value = "A"
Set rng = Range("A1:A500").SpecialCells(xlBlanks)
rng.Formula = "=A1"
Range("A1:A500").Value = Range("A1:A500").Value
Range("A501").EntireRow.Delete
End Sub

the commands for A501 are there to insure the UsedRange of the sheet extends
at least as far as you want to fill since specialcells doesn't work past the
end of the UsedRange.
--
Regards,
Tom Ogilvy




" wrote:

Imagine in Excel you have A1 = 1

A6 = 2

A11 = 3

This is for this weeks data, next week value 2 could be in A7 or A10
or A12 etc.

I want to have the flexibility to fill down from e.g. this week from
A1 to A5 and fill A6 to A10 will a 2 etc.

How can I do this? I can't seem to get the range flexibility, thanks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default Fill Down VBA help please

Hi Don,

The gap from where "1", typically is in A6, yet the location for "2"
could be anywhere below , e.g. in A7, A9 , A20 etc.

After A6 the cells below are blank until there is a value of 2 in
whichever cell it is.

However If(IsBlank) works within Excel via the addition of a column
yet I wish to "hardwire" this in VB. Any suggestions?

Regards,

Simon
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default Fill Down VBA help please

Hi Tom,


Thansk for your reply.


The gap from where "1", is typically in A6, yet the location for "2"
could be anywhere below , e.g. in A7, A9 , A20 etc.

After A6 the cells below are blank until there is a value of 2 in
whichever cell it is.

However If(IsBlank) works within Excel via the addition of a column
yet I wish to "hardwire" this in VB. Any suggestions?
For example (1 uis normally static - actually in A6), the rest of the
cells below are blank, due to a crosstab, until 2 occurs in a cell,
then below the cells are blank until 3, etc, down to 6 currently. The
reason for filling int he blanks is so that a filter can be put in
place:


A1: 1
A2:
A3:
A4:
A5:
A6:
A7: 2
A8:
A9:
A10:
A11:
A12:
A13:
A14 3
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
Fill handle fill down alternative methods question Rufio Excel Discussion (Misc queries) 1 May 18th 09 04:28 PM
Erase fill print then bring fill back Homer Excel Discussion (Misc queries) 5 September 26th 07 01:50 PM
Fill in form to type Item descrictions and costs and fill in funct cradino Excel Worksheet Functions 0 July 16th 06 08:44 PM
I have a list of data, fill in the gaps. FILL function won't work Triv Excel Discussion (Misc queries) 1 September 17th 05 02:33 PM
How to fill colour in Excel, it appers No fill in my computer? bede Excel Discussion (Misc queries) 1 June 11th 05 03:27 AM


All times are GMT +1. The time now is 07:09 PM.

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"