+ Reply to Thread
Results 1 to 2 of 2

Excel VBA cell assignment scripting not appearing

Hybrid View

  1. #1
    Registered User
    Join Date
    06-23-2015
    Location
    Champaign, IL
    MS-Off Ver
    2010
    Posts
    1

    Excel VBA cell assignment scripting not appearing

    I'm trying to create a simple excel script that pulls values from one worksheet, opens a new worksheet and parses the data as it reads one worksheet and puts it in the appropriate places into the new worksheet. This is what I have so far, but for some reason, the cell assignment statements don't appear.

    After debugging, I see that the lines execute, but the values don't appear anywhere in the new worksheet. Any ideas as to why this is happening?

    Private Sub CommandButton21_Click()

    Dim Active As Worksheet
    Set Active = ActiveSheet
    Dim ws As Worksheet
    Set ws = Sheets.Add

    For i = 6 To Cells.Find("*", [A1], , , xlByRows, xlPrevious).Row
    If Not IsEmpty(Active.Cells(i, 2).Value) Then
    ws.Cells(i - 4, 1).Value = Active.Cells(i - 1, 2).Value
    ws.Cells(i, 1).Value = Active.Cells(i - 1, 2).Value

    ElseIf Not IsEmpty(Active.Cells(i, 3).Value) Then
    ...

    If Not IsEmpty(Active.Cells(i, 9).Value) Then
    ...
    End If

    ElseIf Not IsEmpty(Active.Cells(i, 4).Value) Then
    ....
    End If
    Next i

    End Sub

  2. #2
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: Excel VBA cell assignment scripting not appearing

    The code worked for me once I added the red part:
    For i = 6 To Active.Cells.Find("*", [A1], , , xlByRows, xlPrevious).Row
    Some people volunteer in soup kitchens or hospitals. I choose to make the world better by trying to help you with Excel. We're all learning.

    <---Click * Add Reputation for all helpful comments. It's like giving a smile.
    Forum Rules: How to mark your post [Solved] and have a happier, Excel enriched life.

+ 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. [SOLVED] Please help! Excel 2010 VBA insanely slow on cell value assignment
    By dtsolutions in forum Excel Programming / VBA / Macros
    Replies: 28
    Last Post: 03-14-2014, 09:09 AM
  2. Looking to target a cell with no formula (without scripting)
    By griffonwing in forum Excel General
    Replies: 2
    Last Post: 01-29-2011, 05:01 PM
  3. Excel 2007 : Scripting in Excel
    By KMB5 in forum Excel General
    Replies: 1
    Last Post: 10-27-2010, 04:07 AM
  4. When scripting in Excel can you use notepad?
    By simpleonline1234 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-29-2010, 11:18 AM
  5. [SOLVED] VBA scripting in Excel
    By Len in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-26-2006, 11:15 PM

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