ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Looping Down a column (https://www.excelbanter.com/excel-programming/398453-looping-down-column.html)

JV

Looping Down a column
 
I have 2 questions.

First how would I loop down a column starting at cell D3 to cell D250? As
it is looping through if cell D25 for example contains text I need it to move
over to cell E25 cut the formula and paste it in cell D25.

Second scroll down column D again and if cell has a formula I need the whole
row to be made bold and have a border on top and one the bottom.

Thanks in advance.
JV

Tom Ogilvy

Looping Down a column
 
Test this on a copy of your workbook

Don't know if this is exactly what you want, but you may be able to tweak it.

Dim cell as Range
for each cell in Range("D3:D250")
if cell < "" then
if cell.offset(0,1).HasFormula then
s = cell.offset(0,1).Formula
cell.offset(0,1).Value = cell.value
cell.Value = s
cell.EntireRow.font.Bold = True
Else
cell.offset(0,1).Value = cell.Value
cell.ClearContents
end if
End if
Next

--
Regards,
Tom Ogilvy

"JV" wrote:

I have 2 questions.

First how would I loop down a column starting at cell D3 to cell D250? As
it is looping through if cell D25 for example contains text I need it to move
over to cell E25 cut the formula and paste it in cell D25.

Second scroll down column D again and if cell has a formula I need the whole
row to be made bold and have a border on top and one the bottom.

Thanks in advance.
JV


Duke Carey

Looping Down a column
 
Here's a quick example


Const TestText = "text to search for here"

Dim cc as range
for each cc in range("D3:D250")
if cc.text = TestText then cc.formula = cc.offset(0,1).formula
next cc



"JV" wrote:

I have 2 questions.

First how would I loop down a column starting at cell D3 to cell D250? As
it is looping through if cell D25 for example contains text I need it to move
over to cell E25 cut the formula and paste it in cell D25.

Second scroll down column D again and if cell has a formula I need the whole
row to be made bold and have a border on top and one the bottom.

Thanks in advance.
JV



All times are GMT +1. The time now is 09:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com