Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Syntax help with range

I am having trouble with variables/syntax in trying to copy and shift
data from one worksheet to another (Excel 2000)
My Input sheet data is a single column
My Output sheet (in this case) is 2 columns.

Hopefully you can see what I am trying to do with this 'crude' code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim NewTarget As Range
If Target.Column < 1 Then Exit Sub
With Sheets("Output")
NewRow = (Target.Row + (Target.Row - 1) * 3)
NewTarget.Row = NewRow
If Target.Row = 18 Then
NetTarget.Column = 2
Else
NetTarget.Column = 1
End If
.Range(NewTarget.Address).Value = Target.Value
End With
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Syntax help with range

Try this:


Private Sub Worksheet_Change(ByVal Target As Range)
Dim NewRow As Long, NewColumn As Integer
On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Column < 1 Then Exit Sub
With Sheets("Output")
NewRow = (Target.Row + (Target.Row - 1) * 3)
If Target.Row = 18 Then
NewColumn = 2
Else
NewColumn = 1
End If
.Cells(NewRow, NewColumn).Value = Target.Value
End With
ws_exit:
Application.EnableEvents = True
End Sub


HTH

"ZZBC" wrote:

I am having trouble with variables/syntax in trying to copy and shift
data from one worksheet to another (Excel 2000)
My Input sheet data is a single column
My Output sheet (in this case) is 2 columns.

Hopefully you can see what I am trying to do with this 'crude' code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim NewTarget As Range
If Target.Column < 1 Then Exit Sub
With Sheets("Output")
NewRow = (Target.Row + (Target.Row - 1) * 3)
NewTarget.Row = NewRow
If Target.Row = 18 Then
NetTarget.Column = 2
Else
NetTarget.Column = 1
End If
.Range(NewTarget.Address).Value = Target.Value
End With
End Sub

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
help with the syntax for using range name in a formula? BRC[_2_] Excel Discussion (Misc queries) 2 January 9th 10 06:16 PM
VB Syntax to select a range xjetjockey Excel Discussion (Misc queries) 4 January 17th 07 03:12 AM
syntax for range selection saziz[_58_] Excel Programming 2 January 5th 06 08:37 PM
Range syntax Dr.Schwartz Excel Programming 4 May 27th 05 01:34 PM
Syntax for Range Reference Ken Excel Programming 1 December 8th 04 05:15 PM


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