Results 1 to 3 of 3

Editing VBA Code - Not working

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-11-2009
    Location
    Montclair, NJ
    MS-Off Ver
    Excel 365
    Posts
    236

    Editing VBA Code - Not working

    Hey,

    I talked with you guys before about this project and you helped me with some macros which worked PERFECTLY, so thank you sooooo much for that. With the VBA code from the macros, I've been trying to edit the code to make the macro perform another action. Here is the code I'm editing in "Module 1": (This code takes AC3:AC21 from "Sheet1" and records the data in the "F4 - Max" worksheets, then deletes the contents in "Sheet1")

    Sub TransferData2()

    Dim RNG As Range, ws As Worksheet
    Set RNG = Range("AC3:AC21")
    Set ws = Sheets("" & Range("F4") & " - Max")
    RNG.Copy ws.Cells(3, Columns.Count).End(xlToLeft).Offset(0, 1)

    Range("F4").Select
    Selection.ClearContents
    Range("K3:K5").Select
    Selection.ClearContents
    Range("M10:P29").Select
    Selection.ClearContents
    Range("K31:K33").Select
    Selection.ClearContents
    Range("F4").Select
    Selection.ClearContents

    End Sub


    And here is what I'm trying to create to get AD3:AD21 from "Sheet 1" to the "F4 - Avg" worksheet:


    Sub TransferData3()

    Dim RNG As Range, ws As Worksheet
    Set RNG = Range("AD3:AD21")
    Set ws = Sheets("" & Range("F4") & " - Avg")
    RNG.Copy ws.Cells(3, Columns.Count).End(xlToLeft).Offset(0, 1)

    Range("F4").Select
    Selection.ClearContents
    Range("K3:K5").Select
    Selection.ClearContents
    Range("M10:P29").Select
    Selection.ClearContents
    Range("K31:K33").Select
    Selection.ClearContents
    Range("F4").Select
    Selection.ClearContents

    End Sub


    I'm not sure exactly why, but this macro isn't running when I push the "Record Data" button in "Sheet1"

    Could somebody help me out here? And if it isn't too much to ask for, an explanation on why what I'm doing isn't working.

    Thank you sooooo much for your time,
    Bob
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

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