Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
traceydee150
 
Posts: n/a
Default VB Script in Excel to copy a row

I've been using the sample spreadsheets from contexture.com. to do my
projects. Helpful doesn't even come close. However, the sample file
called ProductOrderList has a code that when you move over a cell in
column g, it automatically puts an x in the cell, which copies this row
to another sheet within the file. I'm trying to edit the code, to
where you have to put an x in the cell, not just move over it and I'm
not able to do it. Any help??? Here's the code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 7 And Target.Row 6 Then
If Cells(Target.Row, 1).Value < "" Then
Target.Value = "X"
MoveRow
'MsgBox "Row has been copied"
End If
End If
End Sub

As Always, Thanks

TDee

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Alok
 
Posts: n/a
Default VB Script in Excel to copy a row

Hi
You could try the following

Comment out the Selection Change event.

In the Change event of the worksheet enter the following code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 7 And Target.Row 6 Then
If Target.Cells(1).value = "x" Then
MoveRow
'MsgBox "Row has been copied"
End If
End If
End Sub

Alok

traceydee150 wrote:
I've been using the sample spreadsheets from contexture.com. to do my
projects. Helpful doesn't even come close. However, the sample file
called ProductOrderList has a code that when you move over a cell in
column g, it automatically puts an x in the cell, which copies this row
to another sheet within the file. I'm trying to edit the code, to
where you have to put an x in the cell, not just move over it and I'm
not able to do it. Any help??? Here's the code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 7 And Target.Row 6 Then
If Cells(Target.Row, 1).Value < "" Then
Target.Value = "X"
MoveRow
'MsgBox "Row has been copied"
End If
End If
End Sub

As Always, Thanks

TDee


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
traceydee150
 
Posts: n/a
Default VB Script in Excel to copy a row

Thanks so much - that works - except.... once I put the "X" in the
cell, where ever the cursor ends up, weither it's by hitting enter or
clicking on another row to get out of the cell that's the info that
get's transferred over. IE: If I put an X in g7 and hit enter, row 8
populates in sheet 2, if I put an X in g7 and click onto b19, row 19
populates...... Is there something that can be adjusted?


Alok wrote:
Hi
You could try the following

Comment out the Selection Change event.

In the Change event of the worksheet enter the following code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 7 And Target.Row 6 Then
If Target.Cells(1).value = "x" Then
MoveRow
'MsgBox "Row has been copied"
End If
End If
End Sub

Alok

traceydee150 wrote:
I've been using the sample spreadsheets from contexture.com. to do my
projects. Helpful doesn't even come close. However, the sample file
called ProductOrderList has a code that when you move over a cell in
column g, it automatically puts an x in the cell, which copies this row
to another sheet within the file. I'm trying to edit the code, to
where you have to put an x in the cell, not just move over it and I'm
not able to do it. Any help??? Here's the code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 7 And Target.Row 6 Then
If Cells(Target.Row, 1).Value < "" Then
Target.Value = "X"
MoveRow
'MsgBox "Row has been copied"
End If
End If
End Sub

As Always, Thanks

TDee


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
traceydee150
 
Posts: n/a
Default VB Script in Excel to copy a row

Thanks so much - that works - except.... once I put the "X" in the
cell, where ever the cursor ends up, weither it's by hitting enter or
clicking on another row to get out of the cell that's the info that
get's transferred over. IE: If I put an X in g7 and hit enter, row 8
populates in sheet 2, if I put an X in g7 and click onto b19, row 19
populates...... Is there something that can be adjusted?


Alok wrote:
Hi
You could try the following

Comment out the Selection Change event.

In the Change event of the worksheet enter the following code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 7 And Target.Row 6 Then
If Target.Cells(1).value = "x" Then
MoveRow
'MsgBox "Row has been copied"
End If
End If
End Sub

Alok

traceydee150 wrote:
I've been using the sample spreadsheets from contexture.com. to do my
projects. Helpful doesn't even come close. However, the sample file
called ProductOrderList has a code that when you move over a cell in
column g, it automatically puts an x in the cell, which copies this row
to another sheet within the file. I'm trying to edit the code, to
where you have to put an x in the cell, not just move over it and I'm
not able to do it. Any help??? Here's the code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 7 And Target.Row 6 Then
If Cells(Target.Row, 1).Value < "" Then
Target.Value = "X"
MoveRow
'MsgBox "Row has been copied"
End If
End If
End Sub

As Always, Thanks

TDee


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
traceydee150
 
Posts: n/a
Default VB Script in Excel to copy a row

I found a macro:

Option Explicit

Sub MoveRow()
Dim wsOrder As Worksheet
Dim wsData As Worksheet
Dim r As Long

Set wsOrder = Worksheets("OrderForm")
Set wsData = Worksheets("Data Entry")
r = wsOrder.Cells(Rows.Count, 1).End(xlUp).Row + 1

ActiveCell.EntireRow.Copy Destination:=wsOrder.Cells(r, 1)

End Sub


traceydee150 wrote:
Thanks so much - that works - except.... once I put the "X" in the
cell, where ever the cursor ends up, weither it's by hitting enter or
clicking on another row to get out of the cell that's the info that
get's transferred over. IE: If I put an X in g7 and hit enter, row 8
populates in sheet 2, if I put an X in g7 and click onto b19, row 19
populates...... Is there something that can be adjusted?


Alok wrote:
Hi
You could try the following

Comment out the Selection Change event.

In the Change event of the worksheet enter the following code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 7 And Target.Row 6 Then
If Target.Cells(1).value = "x" Then
MoveRow
'MsgBox "Row has been copied"
End If
End If
End Sub

Alok

traceydee150 wrote:
I've been using the sample spreadsheets from contexture.com. to do my
projects. Helpful doesn't even come close. However, the sample file
called ProductOrderList has a code that when you move over a cell in
column g, it automatically puts an x in the cell, which copies this row
to another sheet within the file. I'm trying to edit the code, to
where you have to put an x in the cell, not just move over it and I'm
not able to do it. Any help??? Here's the code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 7 And Target.Row 6 Then
If Cells(Target.Row, 1).Value < "" Then
Target.Value = "X"
MoveRow
'MsgBox "Row has been copied"
End If
End If
End Sub

As Always, Thanks

TDee


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
how to copy multiple Excel files from Outlook into Excel??? Brainless_in_Boston Excel Discussion (Misc queries) 0 February 24th 06 03:46 PM
EXCEL FILE a copy/a copy/a copy ....filename ve New Users to Excel 1 September 29th 05 09:12 PM
copy & paste spreadsheet cells from excel to outlook to excel mismarple Excel Discussion (Misc queries) 1 September 20th 05 11:16 PM
Copy row, Insert>Copied>Cells crashes Excel Kent Excel Discussion (Misc queries) 0 April 26th 05 10:48 PM
How do i copy columns of data in notepad into excel? JJ Excel Discussion (Misc queries) 1 February 10th 05 09:21 PM


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