Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 23rd, 2010, 07:55 PM
Registered User
 
Join Date: Mar 2010
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default Fill disparate series

In Excel 2003, I am trying to fill a group of disparate series down a single column (i.e.)...

Cell A1 = apple
Cell A2= ""
Cell A3= ""
Cell A4= Banana
Cell A5= ""
Cell A6= ""
Cell A7= ""
Cell A8= ""
Cell A9= Lemon
Cell A10= ""
Cell A11= ""
Cell A12= Grape
(etc)

So that the outcome is:

Cell A1= apple
Cell A2= apple
Cell A3= apple
Cell A4= Banana
Cell A5= Banana
Cell A6= Banana
Cell A7= Banana
Cell A8= Banana
Cell A9= Lemon
Cell A10= Lemon
Cell A11= Lemon
Cell A12= Grape
(etc)

Thanks for any help on this!
 
Old March 24th, 2010, 03:51 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

Here is a hint

Sub Fill_The_Blanks()
Dim sText As String
Dim sNonBlankText As String
Dim i
For i = 1 To 1000
sText = Trim(Cells(i, 1).Value)
If Len(sText) = 0 Then
Cells(i, 1).Value = sNonBlankText
Else
sNonBlankText = sText
End If
Next i
End Sub


Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old March 24th, 2010, 04:22 PM
Registered User
 
Join Date: Mar 2010
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Smile Thanks Shasur!

Yes , that works fine! Thank You! I've been struggling with it for a day now.





Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA macro, Area chart data series fill svif Excel VBA 1 June 5th, 2008 04:17 PM
Data series in reports singhswat Reporting Services 2 April 20th, 2008 10:37 PM
Fill down series yogeshyl Excel VBA 2 April 24th, 2007 03:56 AM
Taylor series Koshe Need help with your homework? 1 April 16th, 2006 09:25 AM
Is parent first element in series cedar XSLT 2 June 8th, 2005 10:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.