Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / November 2006

Tip: Looking for answers? Try searching our database.

Select column range in VB?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alan - 07 Nov 2006 17:42 GMT
Hi - I am using MS XL 2002 and I have created a macro that inputs data
to a specific cell.  I want the macro to input this data in a range of
cells; the data should be input into all the same row cells in column
A, providing there is data in the same rows in Column B.

For example, it should look at column B, realize that there is data in
all cells B2:B121 and input the data into cells A2:A121  I am not
concerned with the inputting of the data, it is specifying the range of
cells to be affected that I am having trouble with.

Hope that is clear enough......

Thanks!

Alan
Gary''s Student - 07 Nov 2006 19:06 GMT
Sub demo()
Dim r As Range, rr As Range
v = 123.456
Set r = Range("A:A")
For Each rr In r
   
   If IsEmpty(rr.Offset(0, 1)) Then
   Else
       rr.Value = v
   End If
Next
End Sub

This little routine travels down column A putting in a value if the neighbor
in column B is not empty.
Signature

Gary''s Student

> Hi - I am using MS XL 2002 and I have created a macro that inputs data
> to a specific cell.  I want the macro to input this data in a range of
[quoted text clipped - 11 lines]
>
> Alan
Alan - 08 Nov 2006 03:18 GMT
Thank you so much for the help!  I plugged it in and voila' - works
great!

- Alan

> Sub demo()
> Dim r As Range, rr As Range
[quoted text clipped - 29 lines]
> >
> > Alan
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.