LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default populate =IF(... dynamically in loop, possible?

On 5/21/2016 3:45 AM, Peter T wrote:
"Claus Busch" wrote in message
Hi Mike,

Am Thu, 19 May 2016 17:02:37 -0700 schrieb Mike S:

For n = 34 To 81
Cells(n, 4).Formula = "=IF(D31," & Cells(n, 2).Address & " /" &
Cells(31, 4).Address & ", 0)"
Next


you don't need that loop. You can create the formula for the whole range
like Peter wrote.
And you don't have to check for 0. 0 divided by any number is always 0.
Try:
Range("D34:D81").Formula = "=B34/$D$31"



Indeed, but any number divided by 0 results in an error :)

another way in 2007 or later
Range("D34:D81").Formula = "=IFERROR(B34/$D$31,0)"

Peter T


Thanks guys. The sheets are done, all 31 of them, I'll keep these notes
for future reference, thanks again.
Mike

 
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
Dynamically populate a Date pulldown menu? Arlen Excel Discussion (Misc queries) 1 July 24th 08 04:20 PM
Dynamically declare and populate variables Gary@Dwight Excel Programming 6 December 5th 07 06:27 PM
Dynamically populate spreadsheets in a workbook peashoe Excel Programming 4 August 8th 07 01:48 PM
Dynamically setting Dimensions in a VBA loop havocdragon Excel Programming 4 September 13th 06 08:34 AM
Populate workbook dynamically?? Dave Cleghorn Excel Programming 4 August 30th 06 04:20 PM


All times are GMT +1. The time now is 01:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"