Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
CBrausa
 
Posts: n/a
Default Macro help


I am entering info given to me here on the Forum, I am getting an error
and this line is highlighted.

For Each myCell In myRange.Cells

I don't know VBA or Macro and am trying to figure it out on my own.

These are the formulas I have been given:
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim myCell As Range
Dim myRange As Range

Set myRange = Nothing
On Error Resume Next
Set myRange = Me.Range("MustFill")
On Error GoTo 0

If myRange Is Nothing Then
MsgBox "Please contact CBrausa at #### to fix the MustFill Range"
Exit Sub
End If

For Each myCell In myRange.Cells
If myCell.Address = myCell.MergeArea.Cells(1).Address Then
If myCell.Value = "" ThenApplication.EnableEvents = False
myCell.Select
Application.EnableEvents = True
Exit For
End If
End If
Next myCell

End Sub

And for the string of cells I need this to apply to:

An alternative way to setting a range is to use a macro:

Option Explicit
Sub testme()
With worksheets("sheet999") '<---
.Range("T4,E5,M5,T7,E8,M8,E14,M14,D16,M16,D18," _
& "M18,L19,M20,N21,U21,N23,B24,K29,B30,L31,B33," _
& "I33,B35,B39,B43,B45,F47,K47,P47,S47,V47,Y47,B 49," _
& "T52,I53,I54,I55,H56,I58,Q50,S55,S56,S57").Nam e _
= "'" & .Name & "'!mustfill"
End With
End Sub

Change the worksheet name to match. (to match what?)

What am I doing wrong?


--
CBrausa
------------------------------------------------------------------------
CBrausa's Profile: http://www.excelforum.com/member.php...o&userid=24677
View this thread: http://www.excelforum.com/showthread...hreadid=543367

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
macro with F9 Kenny Excel Discussion (Misc queries) 1 August 3rd 05 02:41 PM
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM


All times are GMT +1. The time now is 05:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"