[mso] Re: Excel Code
- From: "Herbert Chitate" <herbertc@xxxxxxxxx>
- To: <mso@xxxxxxxxxxxxx>
- Date: Thu, 17 Apr 2008 08:55:00 +0100
Hi Hutch,
Many thanks, the code works, but also kicks up an error dialog box which
says "Run-time error '1004':
That command cannot be used on multiple selections". When I hit debug,
it highlights in yellow the last two lines of the code starting with
Selection.PasteSpecial
Is there a way of getting rid of this error message since the code
actually works?
Many thanks
Herbert
-----Original Message-----
From: mso-bounce@xxxxxxxxxxxxx [mailto:mso-bounce@xxxxxxxxxxxxx] On
Behalf Of Thomas Hutchins
Sent: 16 April 2008 16:55
To: mso@xxxxxxxxxxxxx
Subject: [mso] Re: Excel Code
Try the following macro. Before running it, select the entire range to
be processed (from the first cell with data to the ending row).
=20
Public Sub FillBlanks()
'If only one cell is selected, stop.
If Selection.Count =3D 1 Then Exit Sub
'Select only the blank cells within the selected range.
Selection.SpecialCells(xlCellTypeBlanks).Select
'Enter a formula to pull the value from the cell above.
Selection.FormulaR1C1 =3D "=3DR[-1]C"
'Copy & paste in place as values.
Selection.Copy
Selection.PasteSpecial Paste:=3DxlPasteValues, Operation:=3DxlNone, _
SkipBlanks:=3DFalse, Transpose:=3DFalse
End Sub
Paste the code in a VBA module in your workbook. If you are new to
macros, this link to Jon Peltier's site may be helpful:
http://peltiertech.com/WordPress/2008/03/09/how-to-use-someone-elses-mac
ro/
=20
Hope this helps,
=20
Hutch
=20
Herbert Chitate <herbertc@xxxxxxxxx> wrote:
Hi All,
Can someone help me with a code which does the following:
1) Looks at a cell and if it has something in it, it ignores it, and
goes to the next one down.
2) If the cell is empty, it copies the contents of the cell above it,
and continues to a certain line that I can specify.
Many thanks
Herbert
*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx
or MicrosoftOffice@xxxxxxxxxxxxxxxx
To send mail to the group, simply address it to mso@xxxxxxxxxxxxx
To Unsubscribe from this group, visit the group's homepage and use the
dropdown menu at the top. This will allow you to unsubscribe your email
address or change your email settings to digest or vacation (no mail).
http://www.freelists.org/webpage/mso
To be able to share files with the group, you must join our Yahoo sister
group. This group will not allow for posting of emails, but will allow
you to join and share problem files, templates, etc.:
http://tech.groups.yahoo.com/group/MicrosoftOffice . This group is for
FILE SHARING ONLY.
If you are using Outlook and you see a lot of unnecessary code in your
email messages, read these instructions that explain why and how to fix
it:
http://personal-computer-tutor.com/abc3/v28/greg28.htm
*************************************************************
=20
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try
it now.
*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx
or MicrosoftOffice@xxxxxxxxxxxxxxxx
To send mail to the group, simply address it to mso@xxxxxxxxxxxxx
To Unsubscribe from this group, visit the group's homepage and use the
dropdown menu at the top. This will allow you to unsubscribe your email
address or change your email settings to digest or vacation (no mail).
http://www.freelists.org/webpage/mso
To be able to share files with the group, you must join our Yahoo sister
group. This group will not allow for posting of emails, but will allow
you to join and share problem files, templates, etc.:
http://tech.groups.yahoo.com/group/MicrosoftOffice . This group is for
FILE SHARING ONLY.
If you are using Outlook and you see a lot of unnecessary code in your
email messages, read these instructions that explain why and how to fix
it:
http://personal-computer-tutor.com/abc3/v28/greg28.htm
*************************************************************
*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or
MicrosoftOffice@xxxxxxxxxxxxxxxx
To send mail to the group, simply address it to mso@xxxxxxxxxxxxx
To Unsubscribe from this group, visit the group's homepage and use the dropdown
menu at the top. This will allow you to unsubscribe your email address or
change your email settings to digest or vacation (no mail).
http://www.freelists.org/webpage/mso
To be able to share files with the group, you must join our Yahoo sister group.
This group will not allow for posting of emails, but will allow you to join
and share problem files, templates, etc.:
http://tech.groups.yahoo.com/group/MicrosoftOffice . This group is for FILE
SHARING ONLY.
If you are using Outlook and you see a lot of unnecessary code in your email
messages, read these instructions that explain why and how to fix it:
http://personal-computer-tutor.com/abc3/v28/greg28.htm
*************************************************************
- Follow-Ups:
- [mso] Re: Excel Code
- From: Thomas Hutchins
- References:
- [mso] Excel Code
- From: Herbert Chitate
- [mso] Re: Excel Code
- From: Thomas Hutchins
Other related posts:
- » [mso] Excel Code
- » [mso] Re: Excel Code
- » [mso] Re: Excel Code
- » [mso] Re: Excel Code
- » [mso] Re: Excel Code
- [mso] Re: Excel Code
- From: Thomas Hutchins
- [mso] Excel Code
- From: Herbert Chitate
- [mso] Re: Excel Code
- From: Thomas Hutchins