PC Review


Reply
Thread Tools Rate Thread

Data Fill in Visual Basic

 
 
Carrie
Guest
Posts: n/a
 
      23rd Jan 2008
I have a worksheet designed in columns. There are 0's, 1's & 2's in the
portion I am working with. I have set the 1 and 2's to coinside with a
calendar schedule. The 1 representing the start date and the 2 representing
the end date. In order to refresh my model I need the fill in all the 0's
between the 1 and 2 with 1's. (I may want to convert the 2 to a 1 as well,
not sure yet) Can anyone suggest a way to do this in visual basic? I have had
no luck and I do not want to do it with a formula.

Thx in advance
Carrie
 
Reply With Quote
 
 
 
 
Mark Ivey
Guest
Posts: n/a
 
      23rd Jan 2008
Here is something you can start with: (this is a mod I got from
http://www.mvps.org/dmcritchie/excel/delempty.htm


Sub tester()
ZeroToOne (ActiveSheet.UsedRange) ' modify as needed to pass the range
you need changed to "1"
End Sub

Private Sub ZeroToOne(rng As Range)
Dim ix As Long
If rng Is Nothing Then
GoTo done
End If
For ix = rng.Count To 1 Step -1
If rng.Item(ix).Value = 0 Then
rng.Item(ix).Value = 1
End If
Next
done:
End Sub





"Carrie" <(E-Mail Removed)> wrote in message
news:A1E7644F-47BA-421D-ACB3-(E-Mail Removed)...
> I have a worksheet designed in columns. There are 0's, 1's & 2's in the
> portion I am working with. I have set the 1 and 2's to coinside with a
> calendar schedule. The 1 representing the start date and the 2
> representing
> the end date. In order to refresh my model I need the fill in all the 0's
> between the 1 and 2 with 1's. (I may want to convert the 2 to a 1 as well,
> not sure yet) Can anyone suggest a way to do this in visual basic? I have
> had
> no luck and I do not want to do it with a formula.
>
> Thx in advance
> Carrie


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
visual basic help!! fill out form word PLEASE HELP!!! laandmc Microsoft Word Document Management 1 25th Sep 2008 11:47 AM
Learning curve for Visual Basic 6 programmers moving to Visual Basic.net Chris Asaipillai Microsoft Dot NET 8 20th May 2007 06:24 PM
How to Save Visual Basic Data with Access or Oracle through Data Control or ODBC Mohsin Microsoft Access Queries 2 23rd Dec 2006 05:33 AM
Make a visual basic form fill a page =?Utf-8?B?SEZC?= Microsoft Excel Programming 4 23rd Jan 2005 09:15 PM
How to Sort Data by columns and display the data on GUI using Visual Basic =?Utf-8?B?RGF5YW5hbmQ=?= Microsoft Excel Programming 0 7th Jun 2004 09:41 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:29 AM.