KhanofTarkir
New Member
- Joined
- Sep 3, 2014
- Messages
- 24
Hello,
In the following function, is it possible to change the "valRow As Long" and "valCol As Long" argument placeholders in the function to a data type that allows me to select a specific cell (such as C16)? I realize that the current code allows me to select a cell, but I would like to apply dollaring so that I can have relative references when I copy and paste.
Example:
I want to write in the function that would show up as ADDACROSSSHEETS(C16, 1, 2) instead of ADDACROSSSHEETS(16, 3, 1, 2). This is because I would like to apply dollaring so that I can copy/paste relative references so that ADDACROSSSHEETS(C16, 1, 2) would turn into ADDACROSSSHEETS(D16, 1, 2) in the right adjacent cell and so on. Is this possible?
Thank you!
In the following function, is it possible to change the "valRow As Long" and "valCol As Long" argument placeholders in the function to a data type that allows me to select a specific cell (such as C16)? I realize that the current code allows me to select a cell, but I would like to apply dollaring so that I can have relative references when I copy and paste.
Code:
Function ADDACROSSSHEETS(valRow As Long, valCol As Long, sheetStart As Integer, sheetEnd As Integer) As Variant
For x = sheetStart To sheetEnd
ADDACROSSSHEETS = Sheets(x).Cells(valRow, valCol).Value + ADDACROSSSHEETS
Next x
End Function
Example:
I want to write in the function that would show up as ADDACROSSSHEETS(C16, 1, 2) instead of ADDACROSSSHEETS(16, 3, 1, 2). This is because I would like to apply dollaring so that I can copy/paste relative references so that ADDACROSSSHEETS(C16, 1, 2) would turn into ADDACROSSSHEETS(D16, 1, 2) in the right adjacent cell and so on. Is this possible?
Thank you!