Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Specify target cell

Hello. I am trying to get an output to a specific cell after change in any
cell in a range.

This code does what i want, except it offsets target next to cell.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("h5:h30"), Target) Is Nothing Then
Target.Offset(0, 1).Value = Target
End If
End Sub

How can I replace Target.Offset with only one specific cell for all change
in range?

Thanks in advance :)
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 396
Default Specify target cell

Range("celladdress").Value = Target

or if it should be on a different sheet:

Sheets("nameofthesheet").Range("celladdress").Valu e = Target

If the output cell is part of the range you check in your code, turn off
Events temporarily using Application.EnableEvents.

--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"New Ton" wrote:

Hello. I am trying to get an output to a specific cell after change in any
cell in a range.

This code does what i want, except it offsets target next to cell.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("h5:h30"), Target) Is Nothing Then
Target.Offset(0, 1).Value = Target
End If
End Sub

How can I replace Target.Offset with only one specific cell for all change
in range?

Thanks in advance :)

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Specify target cell

Thank you very much.
I thought i had tried that, but maybe i skipped a space in the code or
something.
Anyways, that did the trick:)

"Wigi" wrote:

Range("celladdress").Value = Target

or if it should be on a different sheet:

Sheets("nameofthesheet").Range("celladdress").Valu e = Target

If the output cell is part of the range you check in your code, turn off
Events temporarily using Application.EnableEvents.

--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"New Ton" wrote:

Hello. I am trying to get an output to a specific cell after change in any
cell in a range.

This code does what i want, except it offsets target next to cell.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("h5:h30"), Target) Is Nothing Then
Target.Offset(0, 1).Value = Target
End If
End Sub

How can I replace Target.Offset with only one specific cell for all change
in range?

Thanks in advance :)

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10
Default Specify target cell

Ok, so far so good. But it seems like it only outputs once.
If another cell in range (h5:h30) changes value after, nothing outputs to
(h31)
Can someone help?
Thanks in advance:)

"Wigi" wrote:

Range("celladdress").Value = Target

or if it should be on a different sheet:

Sheets("nameofthesheet").Range("celladdress").Valu e = Target

If the output cell is part of the range you check in your code, turn off
Events temporarily using Application.EnableEvents.

--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"New Ton" wrote:

Hello. I am trying to get an output to a specific cell after change in any
cell in a range.

This code does what i want, except it offsets target next to cell.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("h5:h30"), Target) Is Nothing Then
Target.Offset(0, 1).Value = Target
End If
End Sub

How can I replace Target.Offset with only one specific cell for all change
in range?

Thanks in advance :)

  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10
Default Specify target cell

Thank you all very much for helping out, it all worked:)

But after I place formula (using row 6 as example) =IF(C6+E6=0;"";B6-C6+E6)
in range "h5:h30" for adding content, Excel will not add that same content in
"H31". That is what this thread was all about in the first place.

Does it have anything to do with manual and application input?
Application.Enablevents?

When i change 'If Not Application.Intersect' to 'If Application.Intersect'
in the code, it seems to add whatever is added in C6 or E6.


"Lars-Ã…ke Aspelin" wrote:

On Fri, 8 Aug 2008 00:16:01 -0700, New Ton <New
wrote:

Hello. I am trying to get an output to a specific cell after change in any
cell in a range.

This code does what i want, except it offsets target next to cell.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("h5:h30"), Target) Is Nothing Then
Target.Offset(0, 1).Value = Target
End If
End Sub

How can I replace Target.Offset with only one specific cell for all change
in range?

Thanks in advance :)



Maybe like this

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("h5:h30"), Target) Is Nothing Then
Range("I10").Value = Target.Value
End If
End Sub

Hope this helps / Lars-Ã…ke

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Specify target cell

It has to with the type of event.

Change event won't react to a calculated value change.

Private Sub Worksheet_Calculate() is the event type you need.


Gord Dibben MS Excel MVP

On Fri, 8 Aug 2008 10:10:00 -0700, New Ton
wrote:

Thank you all very much for helping out, it all worked:)

But after I place formula (using row 6 as example) =IF(C6+E6=0;"";B6-C6+E6)
in range "h5:h30" for adding content, Excel will not add that same content in
"H31". That is what this thread was all about in the first place.

Does it have anything to do with manual and application input?
Application.Enablevents?

When i change 'If Not Application.Intersect' to 'If Application.Intersect'
in the code, it seems to add whatever is added in C6 or E6.


"Lars-Åke Aspelin" wrote:

On Fri, 8 Aug 2008 00:16:01 -0700, New Ton <New
wrote:

Hello. I am trying to get an output to a specific cell after change in any
cell in a range.

This code does what i want, except it offsets target next to cell.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("h5:h30"), Target) Is Nothing Then
Target.Offset(0, 1).Value = Target
End If
End Sub

How can I replace Target.Offset with only one specific cell for all change
in range?

Thanks in advance :)



Maybe like this

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("h5:h30"), Target) Is Nothing Then
Range("I10").Value = Target.Value
End If
End Sub

Hope this helps / Lars-Åke


  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10
Default Specify target cell

Unfornunatley I have two threads going with the same problem, sorry about that.

I got this from Dave Peterson;

Option Explicit
Private Sub Worksheet_Calculate()
Application.EnableEvents = False
Me.Range("g31").Value = Me.Range("g6").Value
Application.EnableEvents = True
End Sub


and it works, except it only returns for "g6"
how can i get it to continue returning value for "g7", "g8", "g9" etc?

Thanks for your great help so far:)

"Gord Dibben" wrote:

It has to with the type of event.

Change event won't react to a calculated value change.

Private Sub Worksheet_Calculate() is the event type you need.


Gord Dibben MS Excel MVP

On Fri, 8 Aug 2008 10:10:00 -0700, New Ton
wrote:

Thank you all very much for helping out, it all worked:)

But after I place formula (using row 6 as example) =IF(C6+E6=0;"";B6-C6+E6)
in range "h5:h30" for adding content, Excel will not add that same content in
"H31". That is what this thread was all about in the first place.

Does it have anything to do with manual and application input?
Application.Enablevents?

When i change 'If Not Application.Intersect' to 'If Application.Intersect'
in the code, it seems to add whatever is added in C6 or E6.


"Lars-Ã…ke Aspelin" wrote:

On Fri, 8 Aug 2008 00:16:01 -0700, New Ton <New
wrote:

Hello. I am trying to get an output to a specific cell after change in any
cell in a range.

This code does what i want, except it offsets target next to cell.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("h5:h30"), Target) Is Nothing Then
Target.Offset(0, 1).Value = Target
End If
End Sub

How can I replace Target.Offset with only one specific cell for all change
in range?

Thanks in advance :)


Maybe like this

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("h5:h30"), Target) Is Nothing Then
Range("I10").Value = Target.Value
End If
End Sub

Hope this helps / Lars-Ã…ke



  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Specify target cell

It's a PITA with multiple threads for the same question.

I'm not sure what you want, but I replied at the other thread.

New Ton wrote:

Unfornunatley I have two threads going with the same problem, sorry about that.

I got this from Dave Peterson;

Option Explicit
Private Sub Worksheet_Calculate()
Application.EnableEvents = False
Me.Range("g31").Value = Me.Range("g6").Value
Application.EnableEvents = True
End Sub


and it works, except it only returns for "g6"
how can i get it to continue returning value for "g7", "g8", "g9" etc?

Thanks for your great help so far:)

"Gord Dibben" wrote:

It has to with the type of event.

Change event won't react to a calculated value change.

Private Sub Worksheet_Calculate() is the event type you need.


Gord Dibben MS Excel MVP

On Fri, 8 Aug 2008 10:10:00 -0700, New Ton
wrote:

Thank you all very much for helping out, it all worked:)

But after I place formula (using row 6 as example) =IF(C6+E6=0;"";B6-C6+E6)
in range "h5:h30" for adding content, Excel will not add that same content in
"H31". That is what this thread was all about in the first place.

Does it have anything to do with manual and application input?
Application.Enablevents?

When i change 'If Not Application.Intersect' to 'If Application.Intersect'
in the code, it seems to add whatever is added in C6 or E6.


"Lars-Ã…ke Aspelin" wrote:

On Fri, 8 Aug 2008 00:16:01 -0700, New Ton <New
wrote:

Hello. I am trying to get an output to a specific cell after change in any
cell in a range.

This code does what i want, except it offsets target next to cell.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("h5:h30"), Target) Is Nothing Then
Target.Offset(0, 1).Value = Target
End If
End Sub

How can I replace Target.Offset with only one specific cell for all change
in range?

Thanks in advance :)


Maybe like this

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("h5:h30"), Target) Is Nothing Then
Range("I10").Value = Target.Value
End If
End Sub

Hope this helps / Lars-Ã…ke




--

Dave Peterson
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
Target cell reference moves when target is cut and pasted Illya Teideman Excel Discussion (Misc queries) 5 May 31st 07 11:34 AM
In cell drop down menu with seprerate numerical target cell Remco Excel Discussion (Misc queries) 2 October 24th 06 11:39 AM
Go to target cell Ed Excel Discussion (Misc queries) 3 May 3rd 06 11:47 PM
In adjacent cell, show last date modified of target cell. manxman Excel Discussion (Misc queries) 0 March 17th 06 10:47 PM
Target value, Next cell D.Parker Excel Discussion (Misc queries) 3 May 4th 05 09:00 PM


All times are GMT +1. The time now is 02:12 PM.

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"