Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-01-2017, 11:02 PM
pourmalla pourmalla is offline Excel VBA macro to copy specific rows and delete it Windows 10 Excel VBA macro to copy specific rows and delete it Office 2016
Novice
Excel VBA macro to copy specific rows and delete it
 
Join Date: Apr 2017
Posts: 1
pourmalla is on a distinguished road
Default Excel VBA macro to copy specific rows and delete it

Hi to every one;
At first thanks in advance to everyone that read my question, and specially help me to fix my problem.
Here what I want to do:
1. I have 2 worksheet named Pending & Records.
2. Column in Pending worksheet: A: Date, B: Delivery To, C: Delivery to office, D: Delivery to Manager, E: Subject, F: Date & G: Letter No.
3. Column in Records worksheet: A: Date, B: Letter No. & C: Subject.
4. When entered number in cell G (Letter No.) of Pending worksheet, the below cells copy to specified cells in Records worksheet.
· E (Subject) in Pending worksheet sit in C (subject) of Records worksheet.
· F (Date) in Pending worksheet sit in A (Date) of Records worksheet.


· G (Letter No.) in Pending worksheet sit in B (Letter No.) of Records worksheet.
5. Deleted the row that copy in Pending worksheet.
6. Sort the rows in Records worksheet according to Letter No. (Column C).
This is codes that I write for what I want to do (not work good) and some screenshot:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 6 Then
If Len(Target.Value) > 0 Then
Dim r As Range
Dim a As String
Dim b As String
b = "sheet3!A" & Sheet1.Cells(1, 9) + 3 & ":C" & Sheet1.Cells(1, 9) + 3
a = "E" & Target.Row & ":G" & Target.Row
Dim r1, r2 As Range
r1 = Sheet1.Range(a)
Sheet2.Range(b).Value = r1
Sheet1.Range(a).EntireRow.Delete
End If
End If
End Sub
Attached Files
File Type: xlsm Please Help.xlsm (20.2 KB, 8 views)

Last edited by pourmalla; 04-02-2017 at 12:13 AM. Reason: upload file
Reply With Quote
  #2  
Old 04-02-2017, 12:04 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Excel VBA macro to copy specific rows and delete it Windows 7 64bit Excel VBA macro to copy specific rows and delete it Office 2010 64bit
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,766
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

Hi and welcome
please post a sample sheet ( click Go advanced - Manage attachments) so the VBA "gurus" can have a look at it more easily
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
  #3  
Old 04-02-2017, 12:09 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Excel VBA macro to copy specific rows and delete it Windows 7 64bit Excel VBA macro to copy specific rows and delete it Office 2010 64bit
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,766
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

Please,do not crosspost your question on multiple forums without including links here to the other threads on other forums.

Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).
http://www.excelguru.ca/forums/showt...-and-delete-it
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel VBA macro to copy specific rows and delete it Macro to delete rows not containing specific text Alimou Excel Programming 4 02-06-2017 07:35 AM
Excel VBA macro to copy specific rows and delete it Want to copy all rows that contain a specific value in column B mcronin Excel Programming 3 06-15-2016 09:44 AM
a macro that can copy data from copy.xls to our current excel macro.xls based on criteria: udhaya Excel Programming 1 11-12-2015 10:12 AM
Excel VBA macro to copy specific rows and delete it Find specific rows then copy and paste to new doc konopca Word VBA 5 02-20-2014 02:34 PM
Excel VBA macro to copy specific rows and delete it Macro to copy specific columns in Excel from another spreadsheet KD999 Excel Programming 1 07-20-2012 08:58 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:08 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft