Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Putting a formula in the first empty cell in a row

Can anyone help me with code that can put a formula in the first empty cell
in a row? Basically, I want to replace the B3 in the following formula so
that it will put the formula in the first empty cell in row 3. I'm trying to
make the following formula dynamic.

Range("B3").FormulaR1C1 = "=SUM(R[1]C[-2]:R[65535]C[-2])"


any help would be appreciated.

--
Regards,

timmulla
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Putting a formula in the first empty cell in a row

Can you find the first open cell by starting at the far right and doing the
equivalent of End|leftArrow.

If yes

dim NextCell as range
with activesheet
set nextcell = .cells(3,.columns.count).end(xltoleft).offset(0,1)
end with

nextcell.formular1c1 = ....



timmulla wrote:

Can anyone help me with code that can put a formula in the first empty cell
in a row? Basically, I want to replace the B3 in the following formula so
that it will put the formula in the first empty cell in row 3. I'm trying to
make the following formula dynamic.

Range("B3").FormulaR1C1 = "=SUM(R[1]C[-2]:R[65535]C[-2])"

any help would be appreciated.

--
Regards,

timmulla


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Putting a formula in the first empty cell in a row


LR=cells(1,"b").end(down).row+1
or you may like this better
LR=cells(rows.count,"b").end(up).row+1

Range("B" & lr).FormulaR1C1 = "=SUM(R[1]C[-2]:R[65535]C[-2])"

--
Don Guillett
SalesAid Software

"timmulla" wrote in message
...
Can anyone help me with code that can put a formula in the first empty
cell
in a row? Basically, I want to replace the B3 in the following formula so
that it will put the formula in the first empty cell in row 3. I'm trying
to
make the following formula dynamic.

Range("B3").FormulaR1C1 = "=SUM(R[1]C[-2]:R[65535]C[-2])"


any help would be appreciated.

--
Regards,

timmulla



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Putting a formula in the first empty cell in a row

Don, he wanted the first empty in row 3, so instead of:

LR=cells(1,"b").end(down).row+1

Try this:

LC = Cells(3,1).End(xlToRight).Column + 1
Cells(3, LC) .FormulaR1C1 = "=SUM(R[1]C[-2]:R[65535]C[-2])"



"Don Guillett" wrote:


LR=cells(1,"b").end(down).row+1
or you may like this better
LR=cells(rows.count,"b").end(up).row+1

Range("B" & lr).FormulaR1C1 = "=SUM(R[1]C[-2]:R[65535]C[-2])"

--
Don Guillett
SalesAid Software

"timmulla" wrote in message
...
Can anyone help me with code that can put a formula in the first empty
cell
in a row? Basically, I want to replace the B3 in the following formula so
that it will put the formula in the first empty cell in row 3. I'm trying
to
make the following formula dynamic.

Range("B3").FormulaR1C1 = "=SUM(R[1]C[-2]:R[65535]C[-2])"


any help would be appreciated.

--
Regards,

timmulla




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
How can I assign a value to a cell without putting a formula in it WFariss Excel Worksheet Functions 4 February 17th 10 01:10 PM
Error putting a formula in a cell with vba cristizet Excel Programming 4 April 22nd 07 02:11 PM
putting a string from one cell in the formula of another -- indirect needed? [email protected] Excel Worksheet Functions 3 January 23rd 06 07:55 PM
Putting Formula in Cell bw Excel Programming 2 November 2nd 05 11:23 AM
Putting Array Formula into each Cell in a Selection (that doesn'ttake eons!) Dave Peterson[_3_] Excel Programming 1 April 1st 04 09:34 AM


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