+ Reply to Thread
Results 1 to 4 of 4

Macro loop crashes excel?

Hybrid View

  1. #1
    Registered User
    Join Date
    10-20-2008
    Location
    Theinternet
    Posts
    4

    Macro loop crashes excel?

    Hey all
    I'm trying to write a macro to update a sheet with new entries from another sheet. The loop I am trying to use to select the first empty cell from the top of the updated sheet crashes or doesn't stop looping when I run it. I have tried using While...Wend, If...Then, and For...Next. I have also tried incorporating a Goto: statement into it. Can anybody tell me what I am doing wrong here?

        ActiveWorkbook.Save
        Dim name As String
        name = ActiveSheet.name
        Worksheets("Overview").Range("A2").Activate
    A:
        If (ActiveCell.HasFormula = True) Then
        Dim row As String
        row = ActiveCell.row
        row = row + 1
        Dim Cell As String
        Cell = "A" & row
        Worksheets("Overview").Range(Cell).Activate
        ElseIf (ActiveCell.HasFormula = False) Then
        GoTo A
        Else
        End If

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    To select the first empty cell below A2,
    Range("a2").end(xldown).offset(1).select
    To select the first empty cell below all used cells in column A,
    cells(rows.count, "A").end(xlup).offset(1).select
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    10-20-2008
    Location
    Theinternet
    Posts
    4
    ok, thanks! That is working, but now i have another issue.
     
    Dim cell As String
    cell = "!c16"
    FormulaR1C1 = "=" & name & cell
    That fills the cell with =name!$Q:$Q rather than =name!c16. I've also tried
    "=" & name & "!c16"
    to the same effect. Why wont it put the correct value in?

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Please start a new thread with your new question.

+ 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. Excel Macro - Read excel & read excel range - save as text
    By se.sathish in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-21-2008, 09:00 AM
  2. Macro to copy data from File A to File B
    By KFT in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-31-2007, 12:49 PM
  3. Problem getting the macro to loop
    By punter in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-12-2007, 03:28 PM
  4. Macro to convert character to hex code in excel
    By thomas908 in forum Excel General
    Replies: 0
    Last Post: 06-27-2007, 02:06 AM
  5. 4.0 macro won't run in Excel 2007
    By ChrisJRutter in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-19-2007, 09:46 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