Computing.Net > Forums > Programming > Marco button, Copy and paste depend

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Marco button, Copy and paste depend

Reply to Message Icon

Name: Death_Knight
Date: February 18, 2009 at 08:32:09 Pacific
OS: Windows XP
CPU/Ram: E8400/3Gig
Product: Buiklt / NA
Subcategory: General
Comment:

Hi,

I am trying to create a marco button that does the following...

Search a set of data in sheet "DaySin" let's say (A5 - F5 and all the way down), if F5 is greater than 0 then create a new sheet call "Result" then copy the entire row and paste the entire row from "Daysin" to "Result" and goes through all the data till column A is blank. Can someone help me with the coding in excel? Thank you



Sponsored Link
Ads by Google

Response Number 1
Name: reno
Date: February 18, 2009 at 22:24:40 Pacific
Reply:

tested on office 07

Function test()
    Dim src As Worksheet
    Set src = Worksheets("Daysin")
    
'    On Error Resume Next
    Worksheets("Result").Delete
    Sheets.Add.Name = "Result"

    If IsNumeric(src.Range("F5").Value) And src.Range("F5").Value > 0 Then
        x = Array("Daysin", "Result")
        Sheets(x).FillAcrossSheets Intersect(src.Range("A5:F999"), src.UsedRange)
    End If
End Function

this will get you started.
Modify the code to suit your need, F1 will help you. Press F1 for help, particularly on worksheet object, range object, and cell.


0

Response Number 2
Name: Death_Knight
Date: February 19, 2009 at 08:57:08 Pacific
Reply:

Hi thanks for replying I am using office 2003, it should pretty much the same. I copied and pasted the code, it when I run it, it copied everything over including the one that are negative. Please help


0

Response Number 3
Name: Death_Knight
Date: February 19, 2009 at 09:51:29 Pacific
Reply:

Oh also if I can add a message box after the marco completed it will be great, maybe like "Check result tab for information". THanks


0

Response Number 4
Name: reno
Date: February 19, 2009 at 16:31:49 Pacific
Reply:

what have you try to modify the code?


0

Response Number 5
Name: Death_Knight
Date: February 20, 2009 at 08:27:51 Pacific
Reply:

No I didn't modify the code, even though "Value > 0 Then" should only picks up positive value but its picking up everything. Any idea why?


0

Related Posts

See More



Response Number 6
Name: reno
Date: February 20, 2009 at 19:52:09 Pacific
Reply:

i'm busy at the moment and dont have the time to write the code, guess you should try to make it works.
yeah, the code works as what i intend it to, if cell value at F5 is number and bigger than 0, then copy used range from "A5:F5-downwards" to new sheet.

so you want to evaluate every cell at column "F", then here is a hint:

for each c (cell) in range at column 5
   if c.value is bigger than 0 then
       do identify the row range of this cell and copy the row to new sheet
   end if
next

search builtin-help (F1) for cell, column, row, and range and looks for available properties and methods that you use.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Select text within batch ... Extracting with FINDSTR



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Marco button, Copy and paste depend

Java Copy and Paste Problems www.computing.net/answers/programming/java-copy-and-paste-problems/12627.html

How can i copy and paste text in vb www.computing.net/answers/programming/how-can-i-copy-and-paste-text-in-vb/5312.html

Using a Macro to copy and paste www.computing.net/answers/programming/using-a-macro-to-copy-and-paste/19690.html