Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 3rd, 2014, 05:40 AM
Authorized User
 
Join Date: Nov 2014
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
Default Error in simple code

HI, I am new to coding.

Kindly help me with the followinf error.

Sub Extraction()
Dim Lastrow As Long
Dim Sheetname As Worksheet

Lastrow = ActiveSheet.UsedRange.Rows.Count
For i = 1 To Lastrow

W = ActiveSheet.Cells(i, 1).Value
If W = "" Then

TempW = ActiveSheet.Cells(i, 2).Value
Else
GoTo STOPP
STOPP:

MsgBox (TempW)
Next i
End Sub

When i run it as a macro, it says that Next i without For.
Kindly help
 
Old November 3rd, 2014, 07:21 PM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

The If statement should end with "End If", which is missing

Regards
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old November 3rd, 2014, 08:44 PM
Authorized User
 
Join Date: Nov 2014
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
Default Thank you

Thanks Shasur. I have recognised it later.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 2 - simple example code php4ever BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 4 October 30th, 2009 07:40 AM
Simple file path code Bafa VB Databases Basics 1 July 31st, 2008 02:22 PM
Very Simple code Tal1481 Beginning VB 6 9 January 29th, 2007 11:12 AM
Very Simple code Tal1481 Visual Basic 2005 Basics 1 January 25th, 2007 07:15 AM
Simple HTML code... rupen HTML Code Clinic 1 October 31st, 2006 06:36 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.