Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Pointing directly to a cell in a range


Hi guys,

Just a quick one, is it possible to point directly to the contents of a
cell that is in a range, although we done know where, without using a
loop to check each cell. For example (note sure which is more correct,
but you get the idea)

MyCell.Offset(0, 3) = wkBk.Worksheets("All Data
Unnarr").Range("B1:B500").Cells("C-ACCOUNTS Total").Offset(0, 3)

or

MyCell.Offset(0, 3) = wkBk.Worksheets("All Data
Unnarr").Range("B1:B500").Range("C-ACCOUNTS Total").Offset(0, 3)

Thanks,

Tom


--
Tomski
------------------------------------------------------------------------
Tomski's Profile: http://www.excelforum.com/member.php...o&userid=26824
View this thread: http://www.excelforum.com/showthread...hreadid=500720

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Pointing directly to a cell in a range

Tom,

Yes, though you need to better explain your criteria for selecting a cell.

Perhaps?

MyCell.Offset(0, 3).Value = _
wkBk.Worksheets("All Data Unnarr").Range("B1:B500").Cells(Range("C-ACCOUNTS
Total").Value).Offset(0, 3).Value

where the value in a cell named "C-ACCOUNTS Total":

Range("C-ACCOUNTS Total").Value

is the indexing value that you want to use

HTH,
Bernie
MS Excel MVP


"Tomski" wrote in message
...

Hi guys,

Just a quick one, is it possible to point directly to the contents of a
cell that is in a range, although we done know where, without using a
loop to check each cell. For example (note sure which is more correct,
but you get the idea)

MyCell.Offset(0, 3) = wkBk.Worksheets("All Data
Unnarr").Range("B1:B500").Cells("C-ACCOUNTS Total").Offset(0, 3)

or

MyCell.Offset(0, 3) = wkBk.Worksheets("All Data
Unnarr").Range("B1:B500").Range("C-ACCOUNTS Total").Offset(0, 3)

Thanks,

Tom


--
Tomski
------------------------------------------------------------------------
Tomski's Profile: http://www.excelforum.com/member.php...o&userid=26824
View this thread: http://www.excelforum.com/showthread...hreadid=500720



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Pointing directly to a cell in a range


Only just had a chance to start looking at todays excel.

Thanks for that, I will give it a try, but that looks to be just what I
was after.

Cheers,

Tom


--
Tomski
------------------------------------------------------------------------
Tomski's Profile: http://www.excelforum.com/member.php...o&userid=26824
View this thread: http://www.excelforum.com/showthread...hreadid=500720

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Pointing directly to a cell in a range


I have tried the above and also a line where I took out the 'value' from
Cells(Range("C-ACCOUNTS
Total").Value), as I was think that this is like an associate array
hence "C-ACCOUNTS Total" would only be needed to reference.

Both throw an error. Any more suggestions as this would save a lot of
time as I am using a loop at the mo, I think unnecessarily.


Cheers,

Tom


--
Tomski
------------------------------------------------------------------------
Tomski's Profile: http://www.excelforum.com/member.php...o&userid=26824
View this thread: http://www.excelforum.com/showthread...hreadid=500720

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Pointing directly to a cell in a range

Tom,

What do you get when you run this:

Sub Test()
Msgbox Range("C-ACCOUNTS Total").Value
End Sub

HTH,
Bernie
MS Excel MVP


"Tomski" wrote in message
...

I have tried the above and also a line where I took out the 'value' from
Cells(Range("C-ACCOUNTS
Total").Value), as I was think that this is like an associate array
hence "C-ACCOUNTS Total" would only be needed to reference.

Both throw an error. Any more suggestions as this would save a lot of
time as I am using a loop at the mo, I think unnecessarily.


Cheers,

Tom


--
Tomski
------------------------------------------------------------------------
Tomski's Profile: http://www.excelforum.com/member.php...o&userid=26824
View this thread: http://www.excelforum.com/showthread...hreadid=500720





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Pointing directly to a cell in a range


Sorry its taken so long to reply, excel is one of many things I do at
work, so it takes me a while to address things.

That doesn't work either, but I am tring to access an inactive
workbook. Here is the basis of my code which should give you a better
idea.

Its a sub routine that takes copies data from a work book on to a work
sheet.


Sub teamData(wkBk As Workbook, wkSt As Worksheet, team As String, datee
As Date)

wkSt.Activate

For Each MyCell In Range("A1:A400").Cells
If MyCell = datee Then

MyCell.Offset(0, 3).Value = wkBk.Worksheets("All Data
Unnarr").Range("A4:O4").Cells(Range("C-ACCOUNTS").Value).Offset(0,
3).Value



End If
Next MyCell

End Sub


Cheers,

Tom


--
Tomski
------------------------------------------------------------------------
Tomski's Profile: http://www.excelforum.com/member.php...o&userid=26824
View this thread: http://www.excelforum.com/showthread...hreadid=500720

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Pointing directly to a cell in a range

Tom,

Which workbook is the range "C-ACCOUNTS" in?

What is the value in "C-ACCOUNTS"? Is it numeric, or is it a string?

What is your criteria for selecting a cell from the range Range("A4:O4")? Matching the value of
"C-ACCOUNTS"?

HTH,
Bernie
MS Excel MVP


"Tomski" wrote in message
...

Sorry its taken so long to reply, excel is one of many things I do at
work, so it takes me a while to address things.

That doesn't work either, but I am tring to access an inactive
workbook. Here is the basis of my code which should give you a better
idea.

Its a sub routine that takes copies data from a work book on to a work
sheet.


Sub teamData(wkBk As Workbook, wkSt As Worksheet, team As String, datee
As Date)

wkSt.Activate

For Each MyCell In Range("A1:A400").Cells
If MyCell = datee Then

MyCell.Offset(0, 3).Value = wkBk.Worksheets("All Data
Unnarr").Range("A4:O4").Cells(Range("C-ACCOUNTS").Value).Offset(0,
3).Value



End If
Next MyCell

End Sub


Cheers,

Tom


--
Tomski
------------------------------------------------------------------------
Tomski's Profile: http://www.excelforum.com/member.php...o&userid=26824
View this thread: http://www.excelforum.com/showthread...hreadid=500720



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Pointing directly to a cell in a range


C-Accounts is the value contained in the cell. I thought that it might
be possible to treat a range as a associate array and use the cell
values to access certain cells in the range.

The reason I want to select the cell containing 'C-ACCOUNTS' is because
I want to get a value in a cell that is 15 rows below.

The range is in workbook wkBk, and the Worksheets is "All Data
Unnarr".

i'm not even sure this is possible, I can always use a loop, but I
thought this way would be tidier.

Cheers,

Tom


--
Tomski
------------------------------------------------------------------------
Tomski's Profile: http://www.excelforum.com/member.php...o&userid=26824
View this thread: http://www.excelforum.com/showthread...hreadid=500720

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
SUMIF - pointing to another cell for criteria Mon Wolff Excel Discussion (Misc queries) 3 February 22nd 07 11:49 AM
Pointing on a cell shows me a list . . .how to do that ? Joël Excel Discussion (Misc queries) 1 November 2nd 06 11:10 AM
trouble shoot pointing to a cell Tracy Excel Worksheet Functions 2 September 13th 05 10:41 PM
Not unhiding rows when pointing to cell to complete formula entry Don Wiss Excel Programming 0 July 2nd 04 12:20 AM
VBA to copy to empty cell directly below a cell when analogous cells in different column have same value as each other? Steven Rosenberg Excel Programming 0 August 5th 03 06:10 AM


All times are GMT +1. The time now is 01:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"