Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-23-2015, 03:45 AM
jap7675 jap7675 is offline Dymanic Range Starting at a Cell Defined by a Count Windows 8 Dymanic Range Starting at a Cell Defined by a Count Office 2007
Novice
Dymanic Range Starting at a Cell Defined by a Count
 
Join Date: Nov 2015
Posts: 6
jap7675 is on a distinguished road
Default Dymanic Range Starting at a Cell Defined by a Count

Hello,

Im trying to run a dynamic range starting at a cell defined by another cell.


The first part of my dynamic range works, ending at a cell defined by another cell.

If CheckBox1.Value = True And CheckBox2.Value = True Then

With Sheets("Summary").Range("E22")
.FormulaArray = "=IFERROR(INDEX('1600 Daily'!G$3:G$300, SMALL(IF('1600 Daily'!$F$2:$F$300=1, ROW('1600 Daily'!$F$2:$F$300)-2),ROWS(G$2:G2))),"""")"
.AutoFill Destination:=Range("E22", Cells(Range("M4"), "E")), Type:=xlFillDefault
End With

End If

I just need this formula performed across the range of cells.
It seems to be this small section that doesnt work 'Range(Cells(Range("M4"), "E")))'

Thanks in advance for any help anyone can provide!
Reply With Quote
  #2  
Old 11-23-2015, 04:42 AM
Debaser's Avatar
Debaser Debaser is offline Dymanic Range Starting at a Cell Defined by a Count Windows 7 64bit Dymanic Range Starting at a Cell Defined by a Count Office 2010 32bit
Competent Performer
 
Join Date: Oct 2015
Location: UK
Posts: 221
Debaser will become famous soon enough
Default

Which cell holds the value of the end row?
Reply With Quote
  #3  
Old 11-23-2015, 04:56 AM
jap7675 jap7675 is offline Dymanic Range Starting at a Cell Defined by a Count Windows 8 Dymanic Range Starting at a Cell Defined by a Count Office 2007
Novice
Dymanic Range Starting at a Cell Defined by a Count
 
Join Date: Nov 2015
Posts: 6
jap7675 is on a distinguished road
Default

Hello,

There are 2 Cases, in one E22 is the start point and ("E" & M4) is the end.
In the second case ("E" & (M5)) is the start point and E300 is the end point. Where M5 = M4+2
Reply With Quote
  #4  
Old 11-23-2015, 05:17 AM
Debaser's Avatar
Debaser Debaser is offline Dymanic Range Starting at a Cell Defined by a Count Windows 7 64bit Dymanic Range Starting at a Cell Defined by a Count Office 2010 32bit
Competent Performer
 
Join Date: Oct 2015
Location: UK
Posts: 221
Debaser will become famous soon enough
Default

On which sheet should M4 and M5 be referenced?
Reply With Quote
  #5  
Old 11-23-2015, 05:49 AM
jap7675 jap7675 is offline Dymanic Range Starting at a Cell Defined by a Count Windows 8 Dymanic Range Starting at a Cell Defined by a Count Office 2007
Novice
Dymanic Range Starting at a Cell Defined by a Count
 
Join Date: Nov 2015
Posts: 6
jap7675 is on a distinguished road
Smile

Hi,

They're both referenced on the sheet "Summary", however the data in the formula that needs to be filled down is referenced from another sheet "1600 plant". It is not necessary to copy that exact formula for the time being - a simpler one will only be necessary for me to understand what to do. :-)
Reply With Quote
  #6  
Old 11-23-2015, 07:15 AM
Debaser's Avatar
Debaser Debaser is offline Dymanic Range Starting at a Cell Defined by a Count Windows 7 64bit Dymanic Range Starting at a Cell Defined by a Count Office 2010 32bit
Competent Performer
 
Join Date: Oct 2015
Location: UK
Posts: 221
Debaser will become famous soon enough
Default

Then:

Code:
With Sheets("Summary").Range("E22")
.FormulaArray = "=IFERROR(INDEX('1600 Daily'!G$3:G$300, SMALL(IF('1600 Daily'!$F$2:$F$300=1, ROW('1600 Daily'!$F$2:$F$300)-2),ROWS(G$2:G2))),"""")"
.AutoFill Destination:=.Range("E22", .Cells(.Range("M4").Value, "E")), Type:=xlFillDefault
End With
should work.
Reply With Quote
  #7  
Old 12-01-2015, 04:05 PM
Graham Griggs Graham Griggs is offline Dymanic Range Starting at a Cell Defined by a Count Windows 8 Dymanic Range Starting at a Cell Defined by a Count Office 2013
Novice
 
Join Date: Dec 2015
Posts: 11
Graham Griggs is on a distinguished road
Default

you give no clue what you are trying to achieve so not sure if it helps but:

you should never be using big complicated formulae like this in VBA
créate a new tab in your spread sheet
set cell a2 to your formula with cell a1 as input to it and cell a3 as the output you want

test until it works under all circumstances

use vba to put the input value into a1 and read the answer from a3

it looks from what you are trying to do, that not using VBA at all is probably the best option - you are not trying to rewrite Excel from scratch
Reply With Quote
  #8  
Old 12-02-2015, 02:12 AM
Debaser's Avatar
Debaser Debaser is offline Dymanic Range Starting at a Cell Defined by a Count Windows 7 64bit Dymanic Range Starting at a Cell Defined by a Count Office 2010 32bit
Competent Performer
 
Join Date: Oct 2015
Location: UK
Posts: 221
Debaser will become famous soon enough
Default

Quote:
Originally Posted by Graham Griggs View Post
you should never be using big complicated formulae like this in VBA
Why on earth not? If it's an appropriate formula, why shouldn't you use code to populate the worksheet with it?
Reply With Quote
Reply

Tags
array, autofill, dynamic range



Similar Threads
Thread Thread Starter Forum Replies Last Post
Dymanic Range Starting at a Cell Defined by a Count Count how many have completed each Training Course within a Date Range dmcmillion Excel 3 10-20-2014 09:59 AM
Dymanic Range Starting at a Cell Defined by a Count Worksheet defined cell sums flextera Excel 3 06-17-2014 11:12 AM
Dymanic Range Starting at a Cell Defined by a Count Data validation list filter with range defined by OFFSET Mango123 Excel 4 03-18-2014 02:52 PM
Dymanic Range Starting at a Cell Defined by a Count Range.Information(wdStartOfRangeRowNumber): Application-defined or Object-defined err tinfanide Excel Programming 2 06-09-2012 10:19 AM
How can I fill cell color starting from Cell D5 using Conditional formatting instead Learner7 Excel 0 07-08-2010 05:50 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:17 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft