Results 1 to 4 of 4

Thread: I am new in VBA and I would like some help in programming with macros

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    2

    Red face I am new in VBA and I would like some help in programming with macros

    Hi, I have a project to accomplish, in which I must read and compare the values of some cells for example from f11 to f 100 with a certain number lets say 10 and then the cells that their values is greater than 10 I would like to compare the cells of another column, for example if I find at the cell F34 a number greater than 10, then I want to check the K34 cell and see if this value is also greater than 10, if so then copy the value fo the F34 cell and paste it to a new workbook to a specific cell for example A2 , then go back and keep checking, if the F51 is greater than 10, then check the K51 cell and if this value too is greater than 10 then copy the value of the F51 and paste it to the new workbook that has been created to the next row A3 and so , on.
    The problem is that I want to do with one macro so I can save it and then use the new workbook as an input for the mathlab.
    So, please if anyone can help with some code, or give me some instructions I would really, really appreciate it, as I do not have much experiance with programming in VB
    Thank you very much.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: I am new in VBA and I would like some help in programming with macros

    Welcome to the Forums.

    I think I need some clarification on the issue. Break it down into sections.
    What I think you may be able to do is use the If statement in the formula bar.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: I am new in VBA and I would like some help in programming with macros

    Flowcharts help. As in making one to see how your program will need to flow.
    If this is an assignment, there is usually a book or tutor to assist, or at least get you started.

    Online there are loads of tutorials, its just a matter of finding what you need and experimenting/learning.

    As posted by Rogdog, the initial checks could (in theory) be done with an excel function, but as you want to get them to their own sheet...

    Also, you could record a macro to see what it does and how it does it, but in this case I do not think that will help much.

    You will need to read up on For...Next loop. Nested Loops and it would be useful for you to at least know a couple of the objects used to reference the sheet and cells (excel help file?).

    Post up your code once you have planned what you want to do.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  4. #4

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    2

    Unhappy Re: I am new in VBA and I would like some help in programming with macros

    I have done this but obviousy is not working, so any help would be very very usefull!! thanx!!

    Range("E10").Select
    For i = 10 To 40
    If Ei > 10 And Fi > 50 Then Range("Ei").Select
    Selection.Copy
    Sheets("Sheet2").Select
    ActiveSheet.Paste
    'Cells(ActiveCell.Row + 1, 1).Select'
    Sheets("Sheet1").Select
    ' Cells(ActiveCell.Row + 1, 1).Select'
    Next i
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width