Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Search, Copy, Paste Macro in Excel | Excel Worksheet Functions | |||
Closing File Error | Excel Discussion (Misc queries) | |||
macro with F9 | Excel Discussion (Misc queries) | |||
Make Alignment options under format cells available as shortcut | Excel Discussion (Misc queries) | |||
Playing a macro from another workbook | Excel Discussion (Misc queries) |