A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Target Question



 
 
Thread Tools Display Modes
  #1  
Old April 4th, 2006, 10:21 AM posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: n/a
Default Target Question


Below is the Macro I have. Instead of doing a copy of entire row I want
just certain cells in that row (A-H). What would be the best way to
accomplish this.

Private Sub Worksheet_Change(ByVal Target As Range)
'
************************************************** **************************************
'
'
************************************************** **************************************
' monitors any change in the worksheet. If it is confined to a single
cell that resides
' in our target column, and has a specific value,
' it will copy the entire row to the next blank row in the target
tab
'
************************************************** **************************************


Dim varAnswer As String
Dim txtMessage As String

txtMessage = "Copy This!"

If Target.Count 1 Then Exit Sub ' more than one cell?
If Target.Column 24 Then Exit Sub ' is this my target row?

Select Case Target.Value ' if matches a case, do the action
required
Case "X" 'check for both upper and lower case
'confirmation step
varAnswer = MsgBox("Copy to Test Tab?", vbYesNo,
txtMessage)
If varAnswer = vbNo Then
Exit Sub
End If
'cut and paste to target tab
Target.EntireRow.Copy
Worksheets("Test").Range("A65536").End(xlUp).Offse t(1, 0)
Case "x" 'check for both upper and lower case
'confirmation step
varAnswer = MsgBox("Copy to Test Tab?", vbYesNo,
txtMessage)
If varAnswer = vbNo Then
Exit Sub
End If
'cut and paste cut and paste to target tab
Target.EntireRow.Copy
Worksheets("Test").Range("A65536").End(xlUp).Offse t(1, 0)
' future use
Case "Cancelled"
Target.EntireRow.Copy Worksheets("Cancelled
Actions").Range("A65536").End(xlUp).Offset(1, 0)
End Select
End Sub


--
jkrist46
  #2  
Old April 5th, 2006, 06:08 AM posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: n/a
Default Target Question


One way

range("a" & target.row & ":h" & target.row).copy


--
mudraker
------------------------------------------------------------------------
mudraker's Profile: http://www.excelforum.com/member.php...fo&userid=2473
View this thread: http://www.excelforum.com/showthread...hreadid=529589

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to email a Snapshot File via Macro. ERROR: "The formats . titlepusher General Discussion 5 November 10th, 2005 03:53 AM
Return Numerical Label for LAST value Subtracted to reach Sum Target Value Sam via OfficeKB.com Worksheet Functions 17 October 31st, 2005 01:46 PM
Question about reducing number of tables in a database tlyczko Database Design 0 October 27th, 2005 04:15 PM
Search my question lost in the long list Shrikant General Discussion 3 August 26th, 2005 09:32 AM
How to gray-out a question dialog box S_Kaplan General Discussion 3 October 26th, 2004 12:11 AM


All times are GMT +1. The time now is 12:59 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.