Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-20-2015, 06:27 AM
Officer_Bierschnitt Officer_Bierschnitt is offline Assemble a destination_range for auto-filling a formula Windows 7 64bit Assemble a destination_range for auto-filling a formula Office 2013
Advanced Beginner
Assemble a destination_range for auto-filling a formula
 
Join Date: Oct 2015
Posts: 79
Officer_Bierschnitt is on a distinguished road
Default Assemble a destination_range for auto-filling a formula

Hi,



I have a formula in, say, cell K1 and I want to fill it downwards - but only up to a specific row which is defined by the length of a list I have copied from another workbook.
Say that list has 33 entries - but it might be different. I can find the last row of this and fill it into a variable no problem.
How do I have to write the command for auto-filling the formula down to row 34 now?
The usual command >> Selection.AutoFill Destination:=Range("K2:K34"), Type:=xlFillDefault <<
won't work of course because I cannot be certain that 34 is the last row - that's why I have that variable. I just can't seem to get the syntax right to fill that into this command ...
Can anybody help me there?

Thanks a lot!

Best regards,

Officer_Bierschnitt
Reply With Quote
  #2  
Old 11-20-2015, 06:47 AM
Debaser's Avatar
Debaser Debaser is offline Assemble a destination_range for auto-filling a formula Windows 7 64bit Assemble a destination_range for auto-filling a formula Office 2010 32bit
Competent Performer
 
Join Date: Oct 2015
Location: UK
Posts: 221
Debaser will become famous soon enough
Default

You need:
Code:
Destination:=Range("K2:K" & your_row_variable_here)
Reply With Quote
  #3  
Old 11-20-2015, 07:15 AM
Officer_Bierschnitt Officer_Bierschnitt is offline Assemble a destination_range for auto-filling a formula Windows 7 64bit Assemble a destination_range for auto-filling a formula Office 2013
Advanced Beginner
Assemble a destination_range for auto-filling a formula
 
Join Date: Oct 2015
Posts: 79
Officer_Bierschnitt is on a distinguished road
Default

OK,

I've made it. A bit of a detour probably as I used a formula written to the worksheet - but it works.

Ah. Debaser, I hadn't seen your post just now. Yes, that would be one step easier than what I did - I generated the exact cell reference (like L32) and then created a string_variable like > L2:L32 < that I could then put in the brackets.

Last edited by Officer_Bierschnitt; 11-20-2015 at 07:17 AM. Reason: just seen a new answer
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Assemble a destination_range for auto-filling a formula Auto update in formula/Obtain the name of the cell Eduardo Care Word 2 08-26-2015 04:45 PM
Wierd... "cell" started auto filling with data from other cells I double click on. How stop it?! KerryOn Excel 2 08-10-2015 08:41 PM
Assemble a destination_range for auto-filling a formula I want to use formula to auto update cells with information Steve81uk Excel 15 01-09-2015 12:58 PM
Assemble a destination_range for auto-filling a formula Auto-adjusting Formula (by date) ShankedS Excel 2 12-03-2014 03:56 PM
Assemble a destination_range for auto-filling a formula matching data from one work sheet to another, then auto filling missing cell information timomaha Excel 1 09-12-2014 07:51 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:06 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