#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Loops

Hi, I was hoping that someone might be able to help me.
I have a list of data that can change in length in terms of rows, but I
want to have a macro that will paste a formula into the adjacent cell
for every non-blank cell within the data set.
ie Column B has 84 rows this time, I want to put a formula in Column C
for the matching number of rows, but when I run the macro next time, I
want it to be able to do the same thing if there is 90 or 40 rows in
Column B.
Any help greatly appreciated!
Thanks,
Paul


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Loops

you can try something like
For row =1to 65000
your code goes here

If cells(row,2)="" then exit sub
next row

good luck

-----Original Message-----
Hi, I was hoping that someone might be able to help me.
I have a list of data that can change in length in terms

of rows, but I
want to have a macro that will paste a formula into the

adjacent cell
for every non-blank cell within the data set.
ie Column B has 84 rows this time, I want to put a

formula in Column C
for the matching number of rows, but when I run the macro

next time, I
want it to be able to do the same thing if there is 90 or

40 rows in
Column B.
Any help greatly appreciated!
Thanks,
Paul


---
Message posted from http://www.ExcelForum.com/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Loops

Define column B as a Range
ColumnB.Select
Dim Cell As Range
For Each Cell In Selection
If cell. value ="" then Cell.offset(0,1).value =
etc...
Next Cell

Should work

-----Original Message-----
Hi, I was hoping that someone might be able to help me.
I have a list of data that can change in length in terms

of rows, but I
want to have a macro that will paste a formula into the

adjacent cell
for every non-blank cell within the data set.
ie Column B has 84 rows this time, I want to put a

formula in Column C
for the matching number of rows, but when I run the

macro next time, I
want it to be able to do the same thing if there is 90

or 40 rows in
Column B.
Any help greatly appreciated!
Thanks,
Paul


---
Message posted from http://www.ExcelForum.com/

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Loops

Dim rng as Range
set rng = Range(Cells(1,2),Cells(1,2).End(xldown))
rng.offset(0,1).Paste

--
Regards,
Tom Ogilvy

"PaulSinki" wrote in message
...
Hi, I was hoping that someone might be able to help me.
I have a list of data that can change in length in terms of rows, but I
want to have a macro that will paste a formula into the adjacent cell
for every non-blank cell within the data set.
ie Column B has 84 rows this time, I want to put a formula in Column C
for the matching number of rows, but when I run the macro next time, I
want it to be able to do the same thing if there is 90 or 40 rows in
Column B.
Any help greatly appreciated!
Thanks,
Paul


---
Message posted from http://www.ExcelForum.com/



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
loops???? harry buggy Excel Worksheet Functions 2 August 14th 07 06:33 PM
Loops [email protected] Excel Discussion (Misc queries) 2 October 14th 06 02:52 PM
Loops... Willabo Excel Discussion (Misc queries) 2 June 14th 06 04:08 PM
Using For - Next Loops in VB Biomed New Users to Excel 4 March 22nd 05 07:12 PM
LOOPS Fernando Duran Excel Programming 2 September 3rd 03 01:07 AM


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