Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Relative Referencing Formulas in Arrays

Are absolute and relative referencing doable in VBA arrays?

Is it possible to put formulas in VBA arrays and make the cells
absolute and relative in the formulas.
_________________
For example: Need to $e4 to cell to be relative, so it will change row
number each time and $F$1 to be absolute. This is in relation to the
code below. Absolute values is okay. However, relative values, I've
tried inserting rc[5] for the relative array value, but this does not
work for the Sub ProcData() macro (see below)


The Array.......
v(0) = Array("Monthly", "=(Text(e4,""dd"")&TEXT($F$1,""-mm-yy""))", 10)



_______________________


Sub ProcData()
Dim v As Variant
Dim v1 As Variant
Dim rng As Range
Dim cell As Range
Dim res As Variant
v1 = Array("M", "S", "Q", "D", "Y")
ReDim v(0 To 4)
v(0) = Array("Monthly", "=(Text(e4,""dd"")&TEXT($F$1,""-mm-yy""))", 10)

v(1) = Array("Semi-Ann", "'3", 30)
v(2) = Array("Quarterly", "'DDE", 25)
v(3) = Array("Decade", "'10y", 4)
v(4) = Array("Yearly", "'123", 5)
Set rng = Range(Cells(3, 4), Cells(3, 4).End(xlDown))
For Each cell In rng
res = Application.Match(cell.Value, v1, 0)
If Not IsError(res) Then
cell.Offset(0, 3).Resize(1, 3).Value = v(res - 1)
End If
Next
End Sub


__________________________
Thanks for any help given.


Brenda

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Relative Referencing Formulas in Arrays

Not really sure what you are trying to do, put the formula in the cell, or
the value, but assuming formula, you should use a variable, and test the
matched value and do an If ... Else..

--
HTH

Bob Phillips

wrote in message
oups.com...
Are absolute and relative referencing doable in VBA arrays?

Is it possible to put formulas in VBA arrays and make the cells
absolute and relative in the formulas.
_________________
For example: Need to $e4 to cell to be relative, so it will change row
number each time and $F$1 to be absolute. This is in relation to the
code below. Absolute values is okay. However, relative values, I've
tried inserting rc[5] for the relative array value, but this does not
work for the Sub ProcData() macro (see below)


The Array.......
v(0) = Array("Monthly", "=(Text(e4,""dd"")&TEXT($F$1,""-mm-yy""))", 10)



_______________________


Sub ProcData()
Dim v As Variant
Dim v1 As Variant
Dim rng As Range
Dim cell As Range
Dim res As Variant
v1 = Array("M", "S", "Q", "D", "Y")
ReDim v(0 To 4)
v(0) = Array("Monthly", "=(Text(e4,""dd"")&TEXT($F$1,""-mm-yy""))", 10)

v(1) = Array("Semi-Ann", "'3", 30)
v(2) = Array("Quarterly", "'DDE", 25)
v(3) = Array("Decade", "'10y", 4)
v(4) = Array("Yearly", "'123", 5)
Set rng = Range(Cells(3, 4), Cells(3, 4).End(xlDown))
For Each cell In rng
res = Application.Match(cell.Value, v1, 0)
If Not IsError(res) Then
cell.Offset(0, 3).Resize(1, 3).Value = v(res - 1)
End If
Next
End Sub


__________________________
Thanks for any help given.


Brenda



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
Stop 2007 from recording formulas with Relative Referencing [email protected] Excel Discussion (Misc queries) 5 June 16th 08 08:09 PM
Relative sheet referencing in excel formulas MichaelR Excel Worksheet Functions 1 June 3rd 08 11:19 PM
Relative references in arrays hmm Excel Discussion (Misc queries) 1 January 11th 07 02:36 PM
Allow relative referencing for imbedded sheetnames in formulas Ted Excel Worksheet Functions 1 March 8th 06 10:10 PM
Relative column referencing within formulas Alistair Excel Discussion (Misc queries) 4 February 23rd 06 05:38 PM


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