[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 164
  • Last Modified:

IF VBA

Hi,

I need to work an IF into some transfer code

I need the transfer code to run onlif IF there is data in "Change Summary" A2, otherwise it should skip code

Thanks

Sheets("Change Summary").Range(Range("A2"), Range("L" & Rows.Count).End(xlUp)).Copy _
    Sheets("Log").Range("A" & Rows.Count).End(xlUp).Offset(1)

Open in new window

0
Seamus2626
Asked:
Seamus2626
  • 2
  • 2
1 Solution
 
dsackerContract ERP Admin/ConsultantCommented:
Something like:
If Range("A2").Value <> "" Then
    Sheets("Change Summary").Range(Range("A2"), Range("L" & Rows.Count).End(xlUp)).Copy _
    Sheets("Log").Range("A" & Rows.Count).End(xlUp).Offset(1)
End If

Open in new window

0
 
Luis PérezSoftware Architect in .NetCommented:
Try this:

If Not (Sheets("Change Summary").Range("A2").Value Is Nothing) Then
    Sheets("Change Summary").Range(Range("A2"), Range("L" & Rows.Count).End(xlUp)).Copy _
    Sheets("Log").Range("A" & Rows.Count).End(xlUp).Offset(1)
End If

Open in new window

Hope that helps.
0
 
Seamus2626Author Commented:
Thanks Luis, i am getting the error "Object Required"
0
 
dsackerContract ERP Admin/ConsultantCommented:
On mine, I assume you may not be in the "Change Summary" sheet, so this may work:
If Sheets("Change Summary").Range("A2").Value <> "" Then
    Sheets("Change Summary").Range(Range("A2"), Range("L" & Rows.Count).End(xlUp)).Copy _
    Sheets("Log").Range("A" & Rows.Count).End(xlUp).Offset(1)
End If

Open in new window

0
 
Seamus2626Author Commented:
Thanks!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now