• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Move entire row into another Sheet

Hi All,


A very very happy new year to all of you....!!


Can somebody help me for my project?


Actually what i want, that i have couple of sheets in excel and column D have different dates in sheet1.


so if i type in userform text box a single date, then if column D have these dates so those entire rows move to another sheet2.


Like...


if D column has 12/1/2012 in five rows, then all rows move into sheet 2.


Thanks in advance.....have a great day
 
Dear Bhushan


As per my idea, you can use advanced filter in VBA to filter the data and copy the entire rows to another sheet. Due lack of details in your post, i can't able to write a code for you.
 
You can download your file here

http://www.2shared.com/document/pgTDSQSQ/mahaveer.html


i hope its useful for you.


Regards

CA Mahaveer Somani
 
Use the following VB code


[pre]<br />
Sub mymethod()<br />
Const TheRange = "A1:D7"<br />
Dim sht As Worksheet</p>
<p> Set sht = ActiveWorkbook.Worksheets.Add<br />
sht.Cells(1, 1).Formula = "=Sheet1!A1"<br />
sht.Range("A1:D1").FillRight<br />
sht.Range(TheRange).FillDown<br />
sht.Range(TheRange).Copy<br />
ActiveWorkbook.Worksheets("Sheet2").Range(TheRange).PasteSpecial xlPasteValues<br />
Application.DisplayAlerts = False<br />
sht.Delete<br />
Application.DisplayAlerts = True</p>
<p>End Sub<br />
[/pre]
 
hi bhushanmorwal

i have not make any restriction to that file

if u want to see coading of that file then follow the following steps:

1. download the file from the http://www.2shared.com/document/pgTDSQSQ/mahaveer.html link

2. Open the file

3.Press Alt + F11

or

Select the devloper tab and open the visual basic.

(If devloper tab is not available in ur excel file then go to Office button (left top button of file) and select Excel option then select popular then select show devloper tab in the ribbon)


there you can see all coding of this file...


I hope it will be useful to you...


Regards

CA Mahaveer Somani
 
Hi, Mahaveer


Thanks for reply, and i know how to check vba coding, but when i go to the userform then i double click on the "commandButton1" i got the error " Object Library invalid or contains references to object definition that could not be found".


i hope you can figure it out......


Thanks

Bhushan Morwal
 
sure dear


Check out the following link now

http://www.2shared.com/document/GHFdm9Ls/mahaveer.html


hope its useful to you again....
 
Hi Mahaveer,


You've done awesome job again....!!! Thanks


But i have one question, in VBA coding you are selecting "Sheet1.Activate". so its mean i have to give name sheet name which i have...!!!!


but in my file there's always generate sheet by month on month...like...Jan's sheet, feb's sheet, march sheet ....and so on...!!


so every time I've to change the sheet name in the VBA coding???


Thanks so much.......

Bhushan
 
no dear bydefault sheet1 has named sheet1 and sheet2 has named sheet2 and so on...

even there is no effect if you changed the sheet name

but if i use example:

Sheets("sheet1").Range("A4").select

and you changed the name of sheet1 = Record

then i will use as follows:

Sheets("Record").range("a4").select

or

sheet1.activate

Range("a4").select

i hope i can explain it properly....


Regards

CA Mahaveer Somani
 
Hi, bhushanmorwal1311!

May I suggest you to change your nick name? It's too long and it overlaps the comment area making it unreadable.

Regards!
 
Back
Top