Results 1 to 3 of 3

VBA / Macro wont work on a different workbook

Threaded View

Gavlar VBA / Macro wont work on a... 09-28-2015, 03:06 PM
Pepe Le Mokko Re: Help with some code 09-28-2015, 03:10 PM
Pepe Le Mokko Re: Help with some code 09-28-2015, 03:11 PM
  1. #1
    Registered User
    Join Date
    06-09-2011
    Location
    England
    MS-Off Ver
    Excel 2022
    Posts
    8

    VBA / Macro wont work on a different workbook

    Hi

    I have copied the following code from a previous workbook but want to apply the same macro on a new workbook (they are not to be linked).

    The trouble is - it doesn't work.

    Can some one help and if possible I need it to search in column I not Column E.

    Sub Invoicing()
    Dim c_ell As Range, Sh_Invoiced As Worksheet, Sh_Snagging As Worksheet, Sh_projects As Worksheet
    Dim Rng_copy As Range
    On Error GoTo E_rror
    Set Sh_projects = ActiveSheet
    Set Sh_Invoiced = Sheets("Invoiced")
    Set Sh_Snagging = Sheets("Snagging")
    For Each c_ell In Range("E4", Cells(Rows.Count, 5).End(xlUp))
    If c_ell.Offset(0, 6) = "Yes" Then
    If Rng_copy Is Nothing Then
    Set Rng_copy = c_ell.EntireRow
    Else
    Set Rng_copy = Union(Rng_copy, c_ell.EntireRow)
    End If
    End If
    Next
    If Rng_copy Is Nothing Then Exit Sub
    Application.CutCopyMode = False
    Rng_copy.Select
    Selection.Copy
    Sh_Invoiced.Select
    Cells(Rows.Count, 5).End(xlUp).Offset(1, -4).PasteSpecial
    Cells(4, 1).Select
    Sh_projects.Activate
    Rng_copy.Select
    Selection.Delete Shift:=xlUp
    Cells(4, 1).Select
    Exit Sub

    E_rror:
    MsgBox "AN error occured", vbOKOnly, "ERROR IN PROCESS"

    End Sub
    Last edited by Gavlar; 09-28-2015 at 03:40 PM. Reason: Title

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Pattern Building VBA Code - Working code, would like to use cleaner code
    By Benisato in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-10-2015, 03:05 PM
  2. Re-code Userform to open range of sheets like previous sheet code
    By JJFletcher in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-15-2014, 02:31 AM
  3. [SOLVED] Excel VB code. Message pops up while code running asking question. Code must not wait.
    By Heinrich Venter in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-28-2014, 06:10 AM
  4. [SOLVED] VBA code for assigning a numeric code to text; then numeric code populates table
    By cteaster in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-14-2014, 08:01 PM
  5. [SOLVED] Excel Macro Visual Basic code not looking at all sheets with second section of code.
    By Heinrich Venter in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-10-2014, 08:26 AM
  6. Replies: 1
    Last Post: 11-13-2013, 10:28 AM
  7. Replies: 2
    Last Post: 03-09-2013, 04:30 AM

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