F
Fred Davis
Hi,
Can anyone spot the error in the following code snippet?
What I want to do is insert a row in a particular place in
a group of sheets - this works from the keyboard but not
from this code:
<<<<<->>>>>
Dim sWard, sSheetName, sAddress, sFormula As String
Dim iAnswer, iWardTotalRow As Integer
' Where are we?
sSheetName = ActiveSheet.Name
sAddress = ActiveCell.Address
' Get the name of the new ward
Do
Beep
sWard = InputBox("Enter name of new Ward or 'Q' to
quit", "New Ward")
Loop Until Len(sWard) > 0
If UCase(sWard) = "Q" Then
iAnswer = MsgBox("Operation cancelled", vbOKOnly)
Exit Sub
End If
Sheets(Array("ACCESS", "GCSE", "TIM
GILBERT", "ART", "BASIC EDUCATION", "Non ESOL", _
"ESOL", "COMM & PROF", "COM LEARN NET", "FAMILY
LEARNING", "FOOD & FLORISTRY", _
"HEALTH &
FITNESS", "ICT", "LANGUAGES", "TEXTILES", "WEFA", "CORPORAT
E")).Select
Sheets(sSheetName).Activate
Range(sAddress).Select
Selection.EntireRow.Insert
<<<<<->>>>>
All it does is insert a row in the active sheet.
Thanks for your help.
Fred
Can anyone spot the error in the following code snippet?
What I want to do is insert a row in a particular place in
a group of sheets - this works from the keyboard but not
from this code:
<<<<<->>>>>
Dim sWard, sSheetName, sAddress, sFormula As String
Dim iAnswer, iWardTotalRow As Integer
' Where are we?
sSheetName = ActiveSheet.Name
sAddress = ActiveCell.Address
' Get the name of the new ward
Do
Beep
sWard = InputBox("Enter name of new Ward or 'Q' to
quit", "New Ward")
Loop Until Len(sWard) > 0
If UCase(sWard) = "Q" Then
iAnswer = MsgBox("Operation cancelled", vbOKOnly)
Exit Sub
End If
Sheets(Array("ACCESS", "GCSE", "TIM
GILBERT", "ART", "BASIC EDUCATION", "Non ESOL", _
"ESOL", "COMM & PROF", "COM LEARN NET", "FAMILY
LEARNING", "FOOD & FLORISTRY", _
"HEALTH &
FITNESS", "ICT", "LANGUAGES", "TEXTILES", "WEFA", "CORPORAT
E")).Select
Sheets(sSheetName).Activate
Range(sAddress).Select
Selection.EntireRow.Insert
<<<<<->>>>>
All it does is insert a row in the active sheet.
Thanks for your help.
Fred