Solved

Covert Excel Formula to Workbook

Posted on 2011-03-11
4
291 Views
Last Modified: 2012-05-11
Hi Experts,

Can someone show me how I would go about applying the following excel code to a workbook. At the moment it applies to a worksheet called 2 Bull Up 3 Bear Dwn 2 Bull Up, but I would like to be able to apply globally on all worksheets.

Sub zolumn()
   With Sheets("2 Bull Up 3 Bear Dwn 2 Bull Up")
      .Range("B2", .Cells(.Rows.Count, "B").End(xlUp)).ClearContents
   End With
End Sub

Cheers
0
Comment
Question by:cpatte7372
  • 3
4 Comments
 
LVL 81

Accepted Solution

by:
zorvek (Kevin Jones) earned 500 total points
ID: 35112890
Sub zolumn()
   Dim Worksheet As Worksheet
   For Each Worksheet In ThisWorkbook.Worksheets
       With Worksheet
           .Range("B2", .Cells(.Rows.Count, "B").End(xlUp)).ClearContents
       End With
   Next Worksheet
End Sub

Kevin
0
 

Author Comment

by:cpatte7372
ID: 35115571
Kev,

Thanks man......
0
 

Author Comment

by:cpatte7372
ID: 35115652
Kev/Experts,

Can someone please also convert the following globally across the workbook as Kevin did above?

Sub Part1()
    Dim lastrow As Long
   
    lastrow = Sheets("Stocks").Range("A" & Rows.Count).End(xlUp).Row
   
    Sheets("Stocks").Range("A1:A" & lastrow).Copy _
    Sheets("Four Lows Five High").Range("B1")
End Sub

Cheers
0
 

Author Closing Comment

by:cpatte7372
ID: 35115958
Cheers
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now