ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Trouble getting the value of a cell (https://www.excelbanter.com/excel-programming/330202-trouble-getting-value-cell.html)

SHIPP

Trouble getting the value of a cell
 
I use a formula to obtain the row of the value I am seeking to obtain which
is in a different worksheet than the one I am working in. I am trying to use
the following

strOffset = "R" & Trim(Str(intColNo)) & "C3"
intDayDiff = Worksheets(strMstSht).Range(strOffset).Value

strOffset does contain the correct column # and returns R7C3. However I get
an error in the intDayDiff line. Any help would be appreciated.
--
M. Shipp

Tom Ogilvy

Trouble getting the value of a cell
 
Range does not support R1C1 references.

I would suggest

Worksheets(strMstSht).Cells(intColNo,3).Value

but why would your row number be in a variable named intColNo?

--
Regards,
Tom Ogilvy

"SHIPP" wrote in message
...
I use a formula to obtain the row of the value I am seeking to obtain

which
is in a different worksheet than the one I am working in. I am trying to

use
the following

strOffset = "R" & Trim(Str(intColNo)) & "C3"
intDayDiff = Worksheets(strMstSht).Range(strOffset).Value

strOffset does contain the correct column # and returns R7C3. However I

get
an error in the intDayDiff line. Any help would be appreciated.
--
M. Shipp




Bernie Deitrick

Trouble getting the value of a cell
 
M.,

Range only accepts A1 style references. So you could use:

strOffset = "C" & intColNo
intDayDiff = Worksheets(strMstSht).Range(strOffset).Value

Or, you could use the .Cells object, which takes row and column numbers:

intDayDiff = Worksheets(strMstSht).Cells(intColNo, 3).Value


HTH,
Bernie
MS Excel MVP


"SHIPP" wrote in message
...
I use a formula to obtain the row of the value I am seeking to obtain

which
is in a different worksheet than the one I am working in. I am trying to

use
the following

strOffset = "R" & Trim(Str(intColNo)) & "C3"
intDayDiff = Worksheets(strMstSht).Range(strOffset).Value

strOffset does contain the correct column # and returns R7C3. However I

get
an error in the intDayDiff line. Any help would be appreciated.
--
M. Shipp




Jim Thomlinson[_4_]

Trouble getting the value of a cell
 
Range does not use RC designations, Cells does. Try using something more like
this:

intDayDiff = Worksheets(strMstSht).Cells(intColNo, 3).Value

--
HTH...

Jim Thomlinson


"SHIPP" wrote:

I use a formula to obtain the row of the value I am seeking to obtain which
is in a different worksheet than the one I am working in. I am trying to use
the following

strOffset = "R" & Trim(Str(intColNo)) & "C3"
intDayDiff = Worksheets(strMstSht).Range(strOffset).Value

strOffset does contain the correct column # and returns R7C3. However I get
an error in the intDayDiff line. Any help would be appreciated.
--
M. Shipp


SHIPP

Trouble getting the value of a cell
 
Thanks very much for everybodys help. In answer to your quesion I am creating
a schedule for the construction industry which takes into consideration
Saturdays, Sundays, and Holidays. I initially set-up a schedule based on days
between steps and days between homes. As the schedule progresses the user can
manually override the calculations. I then do a search backwards on the
schedule to find the first cell that is not a formula. From that point
forward I have to recalculate the workdays to eliminate Sat. Sun. and
Holidays. Because there is a direct relationship between the worksheets I am
able to determine which step and lot I am on and consequently the lead time
between activities.
--
M. Shipp


"Tom Ogilvy" wrote:

Range does not support R1C1 references.

I would suggest

Worksheets(strMstSht).Cells(intColNo,3).Value

but why would your row number be in a variable named intColNo?

--
Regards,
Tom Ogilvy

"SHIPP" wrote in message
...
I use a formula to obtain the row of the value I am seeking to obtain

which
is in a different worksheet than the one I am working in. I am trying to

use
the following

strOffset = "R" & Trim(Str(intColNo)) & "C3"
intDayDiff = Worksheets(strMstSht).Range(strOffset).Value

strOffset does contain the correct column # and returns R7C3. However I

get
an error in the intDayDiff line. Any help would be appreciated.
--
M. Shipp






All times are GMT +1. The time now is 05:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com