MrExcel Message Board


Go Back   MrExcel Message Board > Question Forums > Excel Questions

Notices

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Apr 30th, 2004, 11:21 AM   #1
smoscar
New Member
 
Join Date: Jun 2003
Location: Boca Raton, Florida
Posts: 10
Default Repeatable Macro

Hello, I would like to know how to record the following macro to repeat until it reaches a blank cell: Double click in a cell and then hit enter.

I am not familiar with VBA, and have tried to use the Relative Reference button while recording.

I would really appreciate any help, thanks!
smoscar is offline   Reply With Quote
Old Apr 30th, 2004, 11:25 AM   #2
DRJ
MrExcel MVP
 
DRJ's Avatar
 
Join Date: Feb 2002
Location: California
Posts: 3,857
Default

What do you want to do to the cells? Double click and then enter?
__________________
Excel VBA Training and Certification (Lesson 1 is free)
<hr>

<hr>-Jacob
DRJ is offline   Reply With Quote
Old Apr 30th, 2004, 11:32 AM   #3
Cbrine
Board Regular
 
Cbrine's Avatar
 
Join Date: Dec 2003
Location: Brampton
Posts: 3,185
Default Re: Repeatable Macro

This code should cycle through each cell in the range A1 to the last data value in column A. If it finds a blank cell, it will end.

sub Repeat()
Dim R as range

for each R in activesheet("A1",range("A65000").end(xlup))
If r.value ="" then
Exit loop
End If


Your Code Here
Next
End Sub
__________________
Xcelerated Solutions
Office Automation Solutions for the Toronto Area
Cbrine is offline   Reply With Quote
Old Apr 30th, 2004, 11:47 AM   #4
smoscar
New Member
 
Join Date: Jun 2003
Location: Boca Raton, Florida
Posts: 10
Default

Hi Jacob,
I'm not sure how to respond to you on the message board, but yes, I just want to double click on a cell with a value, and then press enter. Excel requires this to be done when changing the formatting of values.

Regards,
Steve.
smoscar is offline   Reply With Quote
Old Apr 30th, 2004, 12:16 PM   #5
DRJ
MrExcel MVP
 
DRJ's Avatar
 
Join Date: Feb 2002
Location: California
Posts: 3,857
Default

You can use application.doubleclick to send a double click, but if you just want to reformat the cell you can do that without a doubleclick

i.e.

range("A1").Value = Format(Range("A1").Value,"0.00")

So this is just depending on what you specifically want to do.
__________________
Excel VBA Training and Certification (Lesson 1 is free)
<hr>

<hr>-Jacob
DRJ is offline   Reply With Quote
Old Apr 30th, 2004, 12:22 PM   #6
Tom Urtis
MrExcel MVP
 
Tom Urtis's Avatar
 
Join Date: Feb 2002
Location: San Francisco, California USA
Posts: 10,578
Default

Quote:
Originally Posted by DRJ
You can use application.doubleclick to send a double click
What do you mean by that? Can you give an example?
__________________
Tom Urtis
Microsoft MVP - Excel
Tom Urtis is offline   Reply With Quote
Old Apr 30th, 2004, 12:27 PM   #7
DRJ
MrExcel MVP
 
DRJ's Avatar
 
Join Date: Feb 2002
Location: California
Posts: 3,857
Default

Quote:
Originally Posted by Tom Urtis
Quote:
Originally Posted by DRJ
You can use application.doubleclick to send a double click
What do you mean by that? Can you give an example?
OP wanted to double click. I asked what he really wanted to do, but to send a doubleclick you can use application.doubleclick. Or am I missing something?

From Excel Help

DoubleClick Method
See Also Applies To Example Specifics
Equivalent to double-clicking the active cell.

expression.DoubleClick

expression Required. An expression that returns an Application object.

Example
This example double-clicks the active cell on Sheet1.

Worksheets("Sheet1").Activate
Application.DoubleClick
__________________
Excel VBA Training and Certification (Lesson 1 is free)
<hr>

<hr>-Jacob
DRJ is offline   Reply With Quote
Old Apr 30th, 2004, 12:33 PM   #8
Tom Urtis
MrExcel MVP
 
Tom Urtis's Avatar
 
Join Date: Feb 2002
Location: San Francisco, California USA
Posts: 10,578
Default Re: Repeatable Macro

And did you test it? Put this in the Sheet1 module:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
MsgBox "Hello"
End Sub

Doubleclick in Sheet1, and you will see the message box, with the cursor flashing inside the cell you double clicked because now you are in Edit mode.


Go to Sheet2 and run the macro you just posted.

Do you see the message box pop up now? Do you see the cursor flashing in a cell as if you doubleclicked anything?
__________________
Tom Urtis
Microsoft MVP - Excel
Tom Urtis is offline   Reply With Quote
Old Apr 30th, 2004, 12:44 PM   #9
DRJ
MrExcel MVP
 
DRJ's Avatar
 
Join Date: Feb 2002
Location: California
Posts: 3,857
Default

So it doesn't trigger the sheet event. It still sends a double click, though excel probably ignores it if the object is a cell. I played with it a bit, and if the onject is a chart it works.

Anyways I gave the OP two possible solutions to try, if neither of those work I am sure he will post back and someone else can help.
__________________
Excel VBA Training and Certification (Lesson 1 is free)
<hr>

<hr>-Jacob
DRJ is offline   Reply With Quote
Old Apr 30th, 2004, 12:48 PM   #10
erik.van.geit
MrExcel MVP
 
erik.van.geit's Avatar
 
Join Date: Mar 2004
Location: Belgium 3272 Testelt
Posts: 17,303
Default Re: Repeatable Macro

smoscar,
you asked at the start
Quote:
"I would like to know how to record the following macro to repeat until it reaches a blank cell: Double click in a cell and then hit enter. "
further on
Quote:
I just want to double click on a cell with a value, and then press enter. Excel requires this to be done when changing the formatting of values
Excel doesn't require doubleclicking to change format : selecting is enough (in VBA you don't have to select as you can see in the formula from DRJ)
Guys experts, are we not losing focus here ?
or do I really miss something here, then apologise

smoscar,
do you want to format a given range just once or do you need a macro to format several times ?
which range would you like to format ?


just hoping to help in a simple way
regards,
Erik
__________________
I love Jesus
piano improvisation Abba Father

email Erik

founder of DRAFT

my free Addins
Table-It download & info
Formula Translator 04
erik.van.geit is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 09:10 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes