+ Reply to Thread
Results 1 to 3 of 3

Macro with conditions

  1. #1
    Registered User
    Join Date
    10-17-2021
    Location
    Caracas
    MS-Off Ver
    2016
    Posts
    8

    Macro with conditions

    Hello, I need to execute this macro but applying the following:

    - If the last cell in column P of sheet1 is "Woman"

    - If the last cell of column P of sheet1 is "Woman", add the number 7 on sheet 2 in the last cell of column Z

    Thanks for the help

    Sub Copiar()
    With Sheets("Hoja1")
    .Range("A2:E" & .Cells(Rows.Count, 1).End(xlUp).Row).Copy _
    Destination:=Sheets("Hoja2").Range("A" & Sheets("Hoja2").Cells(Rows.Count, 1).End(xlUp).Row + 1)
    Range("A1").Select
    End With
    End Sub

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: Macro with conditions

    Hi ppcash,

    Try this:

    Please Login or Register  to view this content.
    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Registered User
    Join Date
    10-17-2021
    Location
    Caracas
    MS-Off Ver
    2016
    Posts
    8

    Re: Macro with conditions

    The macros are fine, just one thing, that I did not know how to explain well in the first post: the value 7,
    which I want to enter in sheet2, is being copied in row 1 of sheet 2 in column Z. and what I want is to copy it at the same level
    as the last occupied row of the PP column of sheet1. In the attachment it is clearer
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 01-14-2016, 03:53 PM
  2. IF AND Conditions Macro
    By angeleenmc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-22-2015, 12:00 PM
  3. [SOLVED] macro with if/and conditions
    By leandro.fernandez in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-23-2012, 02:23 PM
  4. Can't seem to get the conditions right in this macro
    By hruski in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-06-2011, 06:51 AM
  5. How to record a macro with conditions
    By cbsalt in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-09-2010, 03:23 PM
  6. [SOLVED] Run Macro with conditions
    By mridzuan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-15-2007, 01:57 AM
  7. using IF and AND conditions in a macro
    By iamn94 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-18-2005, 06:06 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1