copy cell based on an empty cell in the same row

Matheson843

New Member
Joined
Aug 9, 2013
Messages
6
Hi,

I need to copy a cell into another spread sheet contingent on whether or not another cell in the row is empty.

For example, I need to copy cell A5 because D5 is empty.. However, if D5 was not empty I would not need to copy A5.

I don't need this macro to loop.

Please help!

Thanks in advance!!
 

hippiehacker

Well-known Member
Joined
Aug 2, 2011
Messages
1,911
how about?

Code:
Sub math()
If Range("D5").Value <> "" Then Range("A5").Copy Sheets("Sheet2").Range("A5")
End Sub
 

Matheson843

New Member
Joined
Aug 9, 2013
Messages
6
Hi Hippiehacker,

Thanks for the response!

However, if D5 is empty I would like the macro to move down to the next cell D6, check if it's empty, and then copy it accordingly.

Any other suggestions??

Thanks!
 

Forum statistics

Threads
1,081,556
Messages
5,359,547
Members
400,533
Latest member
fpenning

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top