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

Hi,
I have a list of numbers which I am searching through, Once I find the one I'm looking for,( eg. in Cell A8), I need to return the value in the adjacent cell,( B8), increment the value in the cell by 1 and return the new value to the cell B8. I was using the lookup function to find the number I was seeking, however, once I get the relevant value and increment it I can't sent it back to the cell it originally came from... Anybody got any ideas??? Any help would be appreciated
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Referencing Cells in Macros

Try something like this:


Sub test1()

Dim anyvalue As Double
Dim anyrange As Range
Set anyrange = Range("A5:A500")
anyvalue = 3
Increment anyvalue, anyrange

End Sub


Sub Increment(What As Double, Where As Range)

Dim rFind As Range
Set rFind = Where.Find(What)
If Not rFind Is Nothing Then
rFind.Offset(0, 1).Value = _
rFind.Offset(0, 1).Value + 1
End If

End Sub

Patrick Molloy
Microsoft Excel MVP



-----Original Message-----
Hi,
I have a list of numbers which I am searching through,

Once I find the one I'm looking for,( eg. in Cell A8), I
need to return the value in the adjacent cell,( B8),
increment the value in the cell by 1 and return the new
value to the cell B8. I was using the lookup function to
find the number I was seeking, however, once I get the
relevant value and increment it I can't sent it back to
the cell it originally came from... Anybody got any
ideas??? Any help would be appreciated
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Referencing Cells in Macros

Formulas can't send values to other cells.

You would need a macro to do this.

--
Regards,
Tom Ogilvy

"Gerry" wrote in message
...
Hi,
I have a list of numbers which I am searching through, Once I find the

one I'm looking for,( eg. in Cell A8), I need to return the value in the
adjacent cell,( B8), increment the value in the cell by 1 and return the new
value to the cell B8. I was using the lookup function to find the number I
was seeking, however, once I get the relevant value and increment it I can't
sent it back to the cell it originally came from... Anybody got any ideas???
Any help would be appreciated


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
referencing cells based on conditions in other cells mirskman Excel Discussion (Misc queries) 1 January 29th 09 09:57 PM
Referencing the same cells Kenton Excel Discussion (Misc queries) 6 November 25th 08 09:57 PM
Referencing several cells with IF? andim Excel Worksheet Functions 2 June 16th 08 11:24 AM
Referencing Cells PAL Excel Worksheet Functions 1 January 23rd 08 08:40 AM
Referencing other cells vfoley Excel Discussion (Misc queries) 4 April 30th 07 05:30 PM


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