Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Excel


Range Offset

I want to apply some logic to a range. However I want to offset the bottom of the range by 1 row.

Example: I have a range (B8:I19) already defined in my vba code. But I want to shade range (B8:I20).

MyRange = Range("B8:B19")
MyRange.Offset(1, 0).Interior.ColorIndex=3

This code also offsets the top of the range (row 9), which I don't want.

How can I only offest the bottom of the range?

View Complete Thread with Replies

Sponsored Links:

Related Forum Messages:
Set Range And Offset
I am having trouble with one line of this code that I can't figure out how to write correctly. I have set the range, but I need to offset by 10 rows up. My code fails at set rng.

View Replies!   View Related
Offset Range Value VBA
I have an offset range ("TheCell") that does not seem be working how I would expect.

I don't know if its because the sheet I am working on was originaly German but I would be surprised if that was the case.

I Use sheet change to set the peramiters of the range and to test the value

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rowcell
Dim colcell
Dim typeit
colcell = ActiveCell.Column
rowcell = ActiveCell.Row
ActiveWorkbook.Names.Add Name:="iname", RefersToR1C1:="=" & "Tabelle2!R1C" & colcell
ActiveWorkbook.Names.Add Name:="Jname", RefersToR1C1:="=" & "Tabelle2!R" & rowcell & "C2"
typeit = Range("TheCell").Value
MsgBox typeit
End Sub

but for some reason I am getting a runtime error 1004 worksheet failed.

I have used this technique before and its been fine so what mistake have I made :o)

View Replies!   View Related
Range.Offset Limit
I am currently writing some VBA code to loop through and copy data from Excel file in sub folders into a master sheet of data. There are some 1200 Excel files (these are pre-2007 files), each containing a maximum of 600 lines of data. So far the code works until it gets to around 65000 rows (the old Excel limit). I am using and writing the code in a Macro-Enabled Excel 2007 file.

I am using a Range.Offset call, which is where the error is occurring, to copy in a name basically. What happened right before this was a Range.Copy operation from the old Excel file to a Range.PastSpecial in the new one. This worked fine, and actually went a few hundred rows past the pre-Excel 2007 limit. But when the single cell operation Range.Offset().Value is called next, it crashes with a Application or User-Defined error. The code works some 100+ times through the loop with no problem, and the file that it was working on is no different then the other files.

View Replies!   View Related
Copying An Offset Range
I would like to work with a range of cells.

I have a headerCel (A2)and a footerCel (A20).

If I use the line

View Replies!   View Related
Go Down Range, Then Cut, Offset, Paste
I am trying to create a macro that goes down Column A of my sheet and looks for a string, "Number". When it finds it, it resize (0, 14) and cuts. Then it pastes the array at an offset of (-1, 10) This is what I got so far:

View Replies!   View Related
Copy A Range, Then Specified By An Offset
I'm trying to copy a range, specified by an offset, then PasteSpecial that range to yet another location specified by an offset.

This is the code I have so far, which does not attempt to find the range to copy via an offset.

View Replies!   View Related
Offset Range Naming
= OFFSET(CustomerInfo!$A$9,0,0, COUNTA(CustomerInfo!A:A),1)

for a "dynamic" range name...i like the concept, but my data validation in a cell that references this "dynamic" range name (with the offset function) doesn't recognize all the values in the range

(when i just range name it, the data validation sees all the names, but not all when i use the offset...)

View Replies!   View Related
Offset X Rows Of Last Row In Range
given a range named xyz which refers to d1:e3


where the 3rd row is blank. I want to examine the row after the range with


I find that this code refers to the last row of the range which is blank. How can I be sure that I will be 1 row (offset=1) below the range?

View Replies!   View Related
Alternative To Offset() In Named Range
I have used Offset() for creating dynamic Named Ranges in Excel 2003. I'm a little disturbed that this usage is no longer supported in Excel 2007? Has anyone else seen this breakdown? What alternatives are available.

In my brief investigation, it looks like opening the .xls in compatibility mode allows the usage to work. However, saving the workbook as a .xlsm (since I also have macros in it) causes any usage of the named range containing Offset() to return an error (both VBA and sheet functions).

View Replies!   View Related
Dynamic Named Range Without Offset()
When I make a dynamic named range, I typically do something like:


I remember awhile ago I saw (within some of the comments on Jon Peltier's site, I believe) a way to make a dynamic named range without using offset. Does anyone know how to do it?

View Replies!   View Related
Combining If, Offset And Range Of Cells
i need to get an equation correct for a scheduling application
assume $f24 is a task frequency and U24 is our current cell location


i am asking if (the range of cells to the left of current cells (range being task frequency -1 columns wide) are empty - and if so - put an x - if they are not empty - then leave it balnk.

i can get it to to work for a 2 weekly schdule but need it to work upto 52 weeks

i have a simple spreadsheet with the problem clearly defined for anyone who can help

- beer in it for anyone who can help - or can pay via paypal if required

View Replies!   View Related
Range Offset Error 1004
I am using the following macro to format a sheet - I recently added a auto-fill part to it which essentially moves a number from one column to another and autofills it in all the cells until it encounters another number of the same kind in the column it moved the previous number from.

When I try to run this macro it does everything upto the auto-fill part and then gives me error 1004 [the set cell = cell.offset(1,0) ] is highlighted in yellow.

View Replies!   View Related
Sumif With Offset Date Range
I am trying to sum multiple columns of data by a sumif based on a criteria in column C, the columns are weekly dated, and I wish to match columns by offset this initial column with a start date and end date and sum columns in between, I have been getting close but only returns one columns values?

FilterCol is column for criteria match
Start Col is name range - OFFSET(FilterCol,0,'Summary totals line groups'!$G$4,1,1) - End col similar, (G4 is a match date to find column ref)

View Replies!   View Related
Offset For Specific Cell Range(s)
I am designing a form that tracks call times. I have a control "cmdStart" that when clicked will enter the "Start" time in cell A4 and each time clicked will skip a column and enter the next time in cell C4. The same for a control "cmdEnd" that will enter the "End" time in cell B4 when clicked. Then the next end time clicked will go in cell D4. However, when the Start time enters the time in AE4 I need the next start time to start in A6 and do the same in this row until AE6 and then drop down again. The same with the "End" time when it reaches AF6. I think I could write the If and Else for each individual cell, but there must be a more efficient way to do this.

View Replies!   View Related
Dynamic Range Using Offset And CountIF
I have a data set that alters each week which means at the moment I have to update the ranges manually each time. I would like to use a dynamic range and think I need to use the Offset and CountIf functions. Both the start and end of the ranges are dynamic. The range is based on grouping the numbers in Column E (LocNo)

What I would like to do or think the way to achieve this is by:

First looking at Column E

Count how many cells are equal to criteria. (CountIf)

offset 5 columns left from the first cell that meets the criteria (Offset -5)

offset X rows down based on how many cells meet the criteria (Offset X)

I've include a spreadsheet spread sheet which 'should' help illustrate the problem showing the ranges I would like and how the data changes each week.

View Replies!   View Related
ActiveCell.Offset - Copy Range
Can i convert this

ActiveCell. Offset(-1, 0).Copy
With ActiveCell
.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End With

So that i can copy/paste the Offset range such as (-1,-2) (-1,1)?

View Replies!   View Related
Dynamic Range - OFFSET Function??
I want to use a dynamic range in order to use this formula below in column A as long as there is something entered in column H = SUMIF($N:$N,A5,$I:$I). any ideas on syntax and will this be using the offset function within excel. I know I have posted a couple times about getting this formula to replicate itself down certain columns as long as someone enters text in another. I looked into the offset reply information somone posted but it seemed a little over my head.

View Replies!   View Related
Color Offset Of Named Range
I've created a named range "Row_16" H16:M16. I've made a macro which colors the interior of this range..

Sub Fill_Row16()
With Selection.Interior
.ColorIndex = 48
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End Sub

I would also like to add a secondary color (Red) to the row just below this range ie H17:M17. Is there a way to offset/ select an entire range.?

View Replies!   View Related
Select Range Using Offset With Variables
I am trying to select a range in VBA, where I know the name of the starting cell, and the size of the range are values returned earlier in the VBA function. I guess the pseudocode I am trying to do is: range(range("StartCell"):range("StartCell").Offset(x,y)).Select. Obviously this code doesn't work, but I don't know the correct way to select this range

View Replies!   View Related
Copy Specific Range To Offset Location
I would appreciate some ones help to correct a macro I'm trying to write. The macro copies 3 columns from Sheet1 to Sheet2 in a selected location. The 3rd column copied needs to be pasted in a different column in Sheet2.

View Replies!   View Related
Return Range. Offset From Start Point
I need help in simulating the functionality of the OFFSET function with some of standard Excel functions which are shown at this webpage (I will be using this converter to generate the webpage from the sheet):

Spreadsheet Converter Supported Functions

I ask this because I need to create an interactive online calculator which absolutely needs to have the ability to allow the user to select the RANGE of the data to be analyzed. I included an example sheet with the offset function in the pink cell…Do you think any other standard excel function can be used to simulate its functionality?

View Replies!   View Related
Cant Get A Range(activecell.offset) Statement To Work
I have a combobox which is linked to a list of policies which has information to the right of them, upon changing the value in the combobox the subroutine below is activated.

It stores the value of the combobox in a string variable, goes to the list and searches for the cell containing the policy. Upon finding the cell it uses the range offset operation to select the two boxes to the right of the active cell. This is where I get my error 1004 - application or object defined error.


Private Sub cmbSectionName_Change()
Dim mySearch As String
'Assigns combobox contents to mysearch
mySearch = cmbSectionName.Value
'select the range
Application.Goto Reference:="SectionNameList"

View Replies!   View Related
Vlookup In Macro With Variable Offset Range
The message shows me "Can not get the vlookup property of worksheetfunction class" and don't know the reason. The 'plancomm' and 'bonus' is the range name in different worksheets of the same workbook as the rngcell.

Case Else:
.Offset(0, 1).Value = WorksheetFunction.VLookup(rngCell.Offset(0, -3), Range("plancomm"), 2, 0)
.Offset(0, 2).Value = WorksheetFunction.VLookup(rngCell.Offset(0, -4) & rngCell.Offset(0, 1), Range("bonus"), 6, 0)

View Replies!   View Related
Offset Cell From Found Maximum In Range
I recently asked how to locate a max value within a variable range using a macro and got the following responses: Get Maximum Value From Graph / Chart, all of which worked great.

Dim r As Range
Set r = Range("D2", Range("D50"))
Range("K1").Value = Application.WorksheetFunction.Max(r)

Range("Max1") = Application.WorksheetFunction.Max(ActiveChart.SeriesCollection(1).Values)
Start = "D24"
Finish = "D163"

Range(Start, Finish).Select
myrange = Selection.Address
Range("Max2") = Application.WorksheetFunction.Max(Selection)

Now I would like for a different cell to return the time value located one column to the left of the max value found above. I've tried to adapt other offset formulas that I've found to my purposes and haven't been able to make it work. how to do that using the max value as it is found in any of the above three ways

View Replies!   View Related
Copy Range Of Cells - Returned Address To Some Offset
Sub TestSearch()
Dim FoundCell As Range
Dim SearchString As Variant
'Specify Value to Search
SearchString = " Excel"
'Perform the Search and Return a Cell Value
Set FoundCell = Worksheets("Source").Range("A1:A10000").Find(" Excel", lookat:=xlPart)
If Not FoundCell Is Nothing Then
MsgBox "Found at " & FoundCell.Address
End If
End Sub

I'd like to take the code above, which returns a cell address which contains the text " Excel" and modify or add to it the capability to copy a range starting from the address returned and ending 102 cells further down in Column A on the Source sheet to A1 of the Sheet1 sheet. The crux of the problem seems to be converting the address to a row number then adding the value of the number of cells in the range to find the end row number then converting that back to an address??

View Replies!   View Related
Add VLOOKUP To Cell (Macro Code) & Offset From Range For Lookup Value
I'm trying to use an offset from a Named Range as my source cell in a vlookup but get a -1004 Object not defined error. When Debugged the Range.Formula appears to be blank when queried. Using Record a Macro the Reference to a named range worked fine but I could not test for an offset or the use of the range reference. What can I do to use to make this work


View Replies!   View Related
Offset Formatting: Place A Header 2 Rows Above This Range Which Is Aligned On The Left
i have a range of cells which is nxn where n>1. i want to place a header 2 rows above this range which is aligned on the left. this is what i tried:

View Replies!   View Related
Find Value, Offset & Return Offset To TextBox
- Find a value on a sheet “ORM” in Column G5:G33

-Get the corresponding value of B5:B33 of that cell

-Place that corresponding value in a canned remark: “You have the number 2 in Block, 12, 14, 25 22.

-Place this canned remark in TextBox31

View Replies!   View Related
Range Name And Range Offset
What I have is a 3 sheet workbook that I want to use as a schedule: 2006,2007,2008. Each sheet consists of many ranges the first range on the 2006 sheet is named fri_July_7 and includes rows 8 to 73. All ranges are named with consecutive dates in this format (someone else on the forum helped me do this) Yes, each range is 65 rows (colum A lists 7AM to 11PM in 15 minute intervals for every day all the way down the sheets). the range name box lists all ranges in alphabeticle order for all 3 sheets, no big deal... I set up a control panel (form) that appears at startup on top of the top 8 blank rows. the active sheet can be used while the user form is active via vbModeless, no problem.

on this floating user form, I have two labels, and 5 buttons. the first label says "the selected day is", the label next to this is blank. The 5 buttons are lined up in a row and the middle one says "GO TO TODAY". The 2 buttons to the left of this say "GO TO LAST WEEK" and "GO TO YESTERDAY"...the other 2 buttons say "GO TO TOMORROW" and "GO TO NEXT WEEK". 1. How do I get the range that actually cooresponds to the real date to be activated and present at startup. 2. How do I have the blank label display a reformated range name (formatted like this "Thursday July 20 2006" for instance) that is determined by what ever the currently displayed range happens to be. 3. I know that the "GO TO TODAY" button will use the same code as the workbook code window that I will need for "1". How do I get the other buttons to jump x ranges ahead or back? I have searched for clues, and tried many things; scroll, offset, step methods... and have some clue, but I just can't seem to put it all together.

View Replies!   View Related
Conditional Formatting: OFFSET Function To Define A Range Inside A SUM Function
In Mr Excel's Pod Cast on April 12th, he showed how to use the OFFSET function to define a range inside a SUM function. Then he had Conditional Formatting that would highlight the range that was being summed. Can anyone tell me what the formula would be inside the Conditional Formatting dialog box to get the OFFSET range to have a certain format?

View Replies!   View Related
Find Last Cell In Range, And Changing Another Cell Based On Offset Text
If i have a range say E12:O12 and want to find the last cell before blank, lets say it finds m12 as the cell with the value before blank. then with m12 it needs to determine weather row 11 in the same column has Text either "S" or "F" if "S" then m12 = t if "F" then m12 offset(1,-1) = t. And just to make things more difficult i need the range E12:O12 to step 2 as well until it gets to E208:O208 .Noting that row 11 never changes and will always have either an "S" Or an "F"

and also t = time()

View Replies!   View Related
Application-defined Or Object-defined Error :: Range & Offset
this is the line it gives the error on.


View Replies!   View Related
Using Offset From Latest Month To Calculate 3-month Average Within A Range
I have a spreadsheet that has columns of monthly values for three years of financial data and where the values for the latest month are added to the last column. Months that have not been completed will have a zero value (e.g. Jul-09).





View Replies!   View Related
Check Each Cell In Range For Value & Put Text In Offset Cell
I'm trying to look at a value in one column (Column A) and if it matches a set of criteria, I'm trying to change the value of another cell 6 columns to the right.(Column G) I've been trying for a couple of days now to get this working, but to no avail. I've tried to modify the code below that I've found on this site but can't quite figure out what I'm doing wrong.

Sub RatingsFix1SP()
Dim FindWhat, rngCell As Range, i As Integer
FindWhat = Array("BB", "B", "CCC", "CC", "C", "CCC+")
For i = 0 To 3
For Each rngCell In Range("A2", Range("A" & Rows.Count).End(xlUp))
If InStr(rngCell, FindWhat(i)) <> 0 Then
rngCell.Offset(0, 6) = 0.15
End If
Next rngCell
Next i
End Sub

To try to clarify a bit: If column A in the attached spreadsheet has a rating code of BB, B, CCC, CC, C, or CCC+, I want the Haircut % rate in column G to be 15%. It seems the code that I'm using changes the % rate to 15% if any "B" or "C" shows up in any part of the string in column A.

View Replies!   View Related
IF And OFFSET: How To OFFSET Only If Cell Has A Value In It
I have attached the .xls file.

The basic setup is as follows:

(1) the user inputs a number into cells B2:B6 (arbitrarily shown as 3,4,3 and 2)

(2) the user then inputs a series of values into the respective columns E, G, I or K (corresponding to examples A-D, respectively) with SPACING between each value corresponding to the value entered in B2:B6.

For example, the value "4" is chosen in B3, so values are entered in column G at time = 0,4,8,12,16,20....etc

As another example, the value "3" is chosen in B4, so values are entered into column I at time = 8,11,14,17,20,23...etc, ie. the starting point is not necessarily t = 0.

(3) once the values have been entered as described in point (2) above, a series of results are automatically calculated in columns F,H,J and L.

NOTE: I have omitted the formulae for the calculation and have just entered arbitrary (color coded for clarity only-i don't need color coding!) numbers alongside each inputted value for the 4 examples A-D.

OK, so what I want to extract from the table for each example is the paired time AND result values, and then show them in a new table.

I have used an OFFSET formula (originally suggested by "daddylonglegs") to do this, and the results i GET are shown in columns O-V.

HOWEVER, what i WANT is the output as shown in columns Y-AF.

So as you will notice, there are 2 problems:

(1) Example C in columns S/T: value in cell B4 = 3, but the first value entered in column I does not start at a multiple of 3, so no values are returned in columns S/T because the offset function only uses row 6 as a reference point. What i want is the result shown in columns AC/AD.

How do i write a formula which says, "look down a column, find the first cell that has a value in it, and then offset from that cell/row" ?

(2) Example D in columns U/V: since the first input in column K starts a t = 12 (ie, cell K18), then i have 5 rows of empty space in columns U/V. What i want is the result shown in columns AE/AF.

Lastly, i should add that i am not necessarily stuck on using OFFSET function, since i keep reading that it is quite volatile.

View Replies!   View Related
Private Sub OptionButton1_Click()

Set primary = Worksheets("Monitor Testing").Cells(20, 4)

For Counter = 1 To 3

If primary.Offset(0, 4)

View Replies!   View Related
I Looking for VBA code For the Below Cases:

Please Refer the below file.

Sheet1 *ABC1CatcityDate2Achennai12/10/20093Bmadurai12/10/20094Bthenai12/10/2009 Excel tables to the web >> Excel Jeanie HTML 4

If cat column states "A" i want to add Amount and value in sheet 3.

Sheet2 *ABCDEF1A *B*2Amountvalue*Amountvalue*31001*8001*42001*9002*53001*12002*64002*15002*75003*18005*86004****97005****108006**** Excel tables to the web >> Excel Jeanie HTML 4

Note : Every catgeory have chances to add Amount and value.(Example A cat Total count 8 but there is a chances to add or deleted 1 or 2 Row)


View Replies!   View Related
VBA: Find And Offset
When I enter a number into cell E2, I would like this number to be searched from A5:A (there will only be 1 unique record, no repeats) and when found for the current time to be put into the corresponding B column.

View Replies!   View Related
I'm trying to lookup a string in a column from another sheet and than return the row on which that string was found. I have two files, one in which my OFFSET/MATCH worked and another in which they didn't work properly.

My problem is this: I have multiple instances of a string in a column and i want to get all the info on that string (the rest of the columns). Let me explain in examples.

In column A on Sheet 2 i have

4 2 4
2 3 4
5 3 2
2 2 2
4 1 3

I need to have in Sheet 1:

4 2 4
4 1 3

Where the first 4 (bolded) is the reference value.

In sheet 1 i have a column A2 which is the reference. In column B2 i have
=MATCH(A2;'Sheet 2'!A1:A16051;1) - this worked on a file but returned a bad value on the other (donno why)

In the second file i used =MATCH(A2;'Sheet 2'!A2:A10552;0)+1 which returned the good value.

For the second value (row 4 1 3) i used =IF(OFFSET('Sheet 2'!A1;B2-2;0)=A2;OFFSET(Sheet 2'!A1;B2-2;0);0). This worked well on the first file but didn't work on the second.

I got the commands above from someone that used to update this file so i don't know exactly how they work

View Replies!   View Related
Offset For The Cells To The Row
how to make offset for the cells to the row -3 in colum B

View Replies!   View Related
Vlookup W/ Offset
I need to add offset to this formula to return the value 1 row down. So it actually would return the values in I39


View Replies!   View Related
I want to use OFFSET in a SUMIF to define the sum range argument...

Essentially this is the OFFSET (simplified) =OFFSET(K108,-50,0,100) (which when I put a SUM around, works.

But, when I put it as the sum_criteria, I get a blank result. =SUMIF(OFFSET(I108,-50,0,100),I108,OFFSET(K108,-50,0,100))

What I want it to do is look at all the cells from 50 above I108 to 50 below I108, and sum the corresponding cells in colum K.

View Replies!   View Related
Offset Sum Formula In VBA
I am using the following code to sum a range of cells in a column and compare the result to another column, bolding that column if the two values are not equal. This works, but I am sure someone can offer me a far more elegant (and perhaps faster?) solution.

Dim rngRange As Range
Dim c As Range

Set rngRange = ActiveSheet.Range("F22:F522")
For Each c In rngRange
If c.Value c.Offset(0, 1) + c.Offset(0, 2) + c.Offset(0, 3) + c.Offset(0, 4) + c.Offset(0, 5) + c.Offset(0, 6) + c.Offset(0, 7) + c.Offset(0, 8) + c.Offset(0, 9) + c.Offset(0, 10) Then
c.Font.Bold = True
c.Font.Bold = False
End If
Next c

View Replies!   View Related
Offset And Resize
I have 3 workbooks, the first one contains the data and the second is the “Table1” containing "Normal records" and the third is the “Table 2” containing only "900 Records". Tables 1 and 2 will be linked to Access…..

Here’s my issue….

From workbook 1, I would like to copy data from certain cells that contain data to Table 1

From workbook 1, I would like to copy data from certain cells that contain 900 service records data to Table 2

In workbook 1, I have identified which information i want to keep by using the following formula,

View Replies!   View Related
Offset A Vlookup
i have a table with customers and the rentals they have made. in the table it has their customer number and then the item code of the item they have rented out.

i want to have a table that brings up the item codes of what they have rented but with a vlookup it only brings back the first item they have rented and not the ones after that.

View Replies!   View Related
Offset Problem
I am trying to write code that will take values in a horizontal column (which are updated periodically) and transpose (copy vertically) them in another column. When the horizontal section is updated, I would like for the new data to be copied to the next open vertical line.

how to get this to offset to rows z9, z10, z11 etc....

Selection.PasteSpecial Paste:=xlPasteValues, Transpose:=True

View Replies!   View Related
OFFSET With Variables
I am trying to OFFSET from cell A1 based upon a variable in cell A2. The cell I need to OFFSET to is also located in column A, but it could always differ based upon the variable in A2. Here is the piece of code performing this OFFSET.

View Replies!   View Related
Offset And End Properties
I have attach the lab2.xls files below.

1. Download “ Range Data.xls”.

2. Use the Offset and End properties of Range object to name range from A2 to the end of the column as “NEmployees”, range B1 to the end of the row as “NScores”,and the rest of the range, B2 to F19, as “ScoreData”.

3. Do some formatting using the range names and the With-End With construction: make the font of the NEmployees Range in bold and blue color; change the font of the NScores Range to italic, in red and centralize the text (using the HorizontalAlignment property).

View Replies!   View Related
YTD Formula Using Offset
I saw a formula on another website that shows calculating a YTD formula using the offset function. The address is:

I was working on a version where you enter the months in row 1, number data in row 2, and have the month to use in the formula in cell N2 but it did not work. Any suggestions on how to do it properly? Here is my formula:


View Replies!   View Related
Copyright © 2005-08, All rights reserved