Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problem with Excel Form and VBA code


Hello.

I use a vba code that make excel to copy, in automatic way, a row from
a sheet to another, inclused the images (if there are), when I put a
number in the first cell of the row.

I use this for select some product from a catalog to make an order, and
it work well.

Now I try to select the cells (the first of the rows) through the
"Form" (from Data Form...). The form select the cell but the vba code
dont work and excel dont copy the rows that I select to the next sheet.


Know somebody how can I do to make it?
Thanks.

__________________________________________________ ___________

This is the code that I use:

*Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Long, x As String, y As Range, cell As Range
If Target.Column < 2 Then Exit Sub
If Target.Cells.Count 1 Then Exit Sub
i = Target.Row
Application.ScreenUpdating = False

If Target < "" Then
If Sheets("customer copy").Cells(1, 1) = "" Then
Cells(i, 1).EntireRow.Copy Sheets("customer copy").Cells(1, 1)
Else: Cells(i, 1).EntireRow.Copy Sheets("customer copy").Cells(65536,
1).End(xlUp)(2, 1)
End If
End If

If Target = "" Then
x = Sheets("choice copy").Cells(i, 1).Value
Sheets("customer copy").Select
For Each c In
ActiveSheet.Columns("A:A").SpecialCells(xlCellType Constants, 3)
If c.Value = x Then
c.EntireRow.Delete
End If
Next
Sheets("choice copy").Select
End If

Application.ScreenUpdating = True
End Sub*


--
milt2005
------------------------------------------------------------------------
milt2005's Profile: http://www.excelforum.com/member.php...o&userid=21404
View this thread: http://www.excelforum.com/showthread...hreadid=513221

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Problem with Excel Form and VBA code

Selecting a record through Data, Form is not the same thing as actually
selecting a worksheet cell. As far as I know it is not possible to trigger
a macro by what you do in a Data Form.

--
Jim
"milt2005" wrote in
message ...
|
| Hello.
|
| I use a vba code that make excel to copy, in automatic way, a row from
| a sheet to another, inclused the images (if there are), when I put a
| number in the first cell of the row.
|
| I use this for select some product from a catalog to make an order, and
| it work well.
|
| Now I try to select the cells (the first of the rows) through the
| "Form" (from Data Form...). The form select the cell but the vba code
| dont work and excel dont copy the rows that I select to the next sheet.
|
|
| Know somebody how can I do to make it?
| Thanks.
|
| __________________________________________________ ___________
|
| This is the code that I use:
|
| *Private Sub Worksheet_Change(ByVal Target As Range)
| Dim i As Long, x As String, y As Range, cell As Range
| If Target.Column < 2 Then Exit Sub
| If Target.Cells.Count 1 Then Exit Sub
| i = Target.Row
| Application.ScreenUpdating = False
|
| If Target < "" Then
| If Sheets("customer copy").Cells(1, 1) = "" Then
| Cells(i, 1).EntireRow.Copy Sheets("customer copy").Cells(1, 1)
| Else: Cells(i, 1).EntireRow.Copy Sheets("customer copy").Cells(65536,
| 1).End(xlUp)(2, 1)
| End If
| End If
|
| If Target = "" Then
| x = Sheets("choice copy").Cells(i, 1).Value
| Sheets("customer copy").Select
| For Each c In
| ActiveSheet.Columns("A:A").SpecialCells(xlCellType Constants, 3)
| If c.Value = x Then
| c.EntireRow.Delete
| End If
| Next
| Sheets("choice copy").Select
| End If
|
| Application.ScreenUpdating = True
| End Sub*
|
|
| --
| milt2005
| ------------------------------------------------------------------------
| milt2005's Profile:
http://www.excelforum.com/member.php...o&userid=21404
| View this thread: http://www.excelforum.com/showthread...hreadid=513221
|


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 start a VB6 program form Excel VBA macro code ? Øyvind Excel Programming 2 November 27th 05 04:50 PM
Adding code to control on form causes Excel to crash skuzapo Excel Programming 3 September 22nd 05 09:14 PM
Adding code to a control on a form causes excel to crash Skuzapo Excel Programming 1 September 21st 05 02:13 PM
Excel VBA Form problem Matt000 Excel Programming 2 February 19th 04 06:16 PM
Excel User Form problem humet Excel Programming 5 December 11th 03 09:37 PM


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