Re: Macro To Generate Message Box Based On Colour Of Cells On A Sheet
have you got a sample worksheet to go off?
Re: Macro To Generate Message Box Based On Colour Of Cells On A Sheet
have you got a sample worksheet to go off?
Re: List Files In A Folder In A Worksheet
very cleaver :o)
Re: Vbnullstring: Runtime Error -2147417848
untested
Dim max_reihen, lowestRow, latestCol As long
Dim wksA As Worksheet
'[...]
Set wksA =ActiveSheet
With wksA
.Range("A1").activate 'sets focus from possibly selected chart back to sheet
max_reihen=526 'state of variable just before the critical line is met
lowestRow=2000 'state of variable just before the critical line is met
latestCol=26 'state of variable just before the critical line is met
.Range(.Cells(max_reihen, 1), .Cells(lowestRow, latestCol)) = Empty '<--CRITICAL LINE causing runtime error -2147417848
'[...]
'.Range(.Cells(max_reihen, 1), .Cells(lowestRow, latestCol)).ClearContents '<-- this was my alternative, but this causes a "Runtime error 1004" instead
'[...]
End With
Display More
Re: Locking Cell If Value
try something along the lines of this
Private Sub Worksheet_Change(ByVal Target As Range)
Dim iRangeSource, iRangeChange As Range
Dim ws As Worksheet
Dim pass As String
pass = "PASSWORD"
Set ws = ActiveSheet
Set iRangeSource = Range("K4")
Set iRangeChange = Range("F6")
Select Case UCase(iRangeSource)
Case "DAILY"
ws.Unprotect '(pass)
iRangeChange.Locked = False
ws.Protect '(pass)
Case "MONTHLY"
ws.Unprotect '(pass)
iRangeSource.Locked = False
iRangeChange.Locked = True
ws.Protect '(pass)
End Select
Set ws = Nothing
Set iRangeSource = Nothing
Set iRangeChange = Nothing
End Sub
Display More
Re: Import Calendar Days To Specific Cells
Further to Will's post you'll need to add a reference library in vba
Microsoft Outlook 1x.xx Object Library
Re: Change Access Default Warning Message
you can do this on the property before update...
Please note you'll need the Reference Microsoft DAO 3.xx Object Library
Private Sub textboxCombobox_BeforeUpdate(Cancel As Integer)
Dim SID As String
Dim stLinkCriteria As String
Dim Rst As DAO.Recordset
Set Rst = Me.RecordsetClone
SID = Me.textboxCombobox.Value
stLinkCriteria = "[field]=" & "'" & SID & "'"
'Check table for duplicates
If DCount("textboxCombobox", "tblname", stLinkCriteria) > 0 Then
'Undo duplicate entry
Me.Undo
'Message box warning of duplication
MsgBox "Warning Number " _
& SID & " has already been entered." _
& vbCr & vbCr & "You will now been taken to the record.", vbInformation _
, "Duplicate Information"
'Go to original record
Rst.FindFirst stLinkCriteria
Me.Bookmark = Rst.Bookmark
End If
Set Rst = Nothing
End Sub
End Sub
Display More
Re: Changing Borders In A Document With Vba
something like this should help you
Sub formatCurrentRegion()
Selection.CurrentRegion.Select
With Selection
.Borders(xlDiagonalDown).LineStyle = xlNone
.Borders(xlDiagonalUp).LineStyle = xlNone
.Borders(xlEdgeLeft).LineStyle = xlContinuous
.Borders(xlEdgeLeft).Weight = xlThin
.Borders(xlEdgeLeft).ColorIndex = xlAutomatic
.Borders(xlEdgeTop).LineStyle = xlContinuous
.Borders(xlEdgeTop).Weight = xlThin
.Borders(xlEdgeTop).ColorIndex = xlAutomatic
.Borders(xlEdgeBottom).LineStyle = xlContinuous
.Borders(xlEdgeBottom).Weight = xlThin
.Borders(xlEdgeBottom).ColorIndex = xlAutomatic
.Borders(xlEdgeRight).LineStyle = xlContinuous
.Borders(xlEdgeRight).Weight = xlThin
.Borders(xlEdgeRight).ColorIndex = xlAutomatic
.Borders(xlInsideVertical).LineStyle = xlContinuous
.Borders(xlInsideVertical).Weight = xlThin
.Borders(xlInsideVertical).ColorIndex = xlAutomatic
.Borders(xlInsideHorizontal).LineStyle = xlContinuous
.Borders(xlInsideHorizontal).Weight = xlThin
.Borders(xlInsideHorizontal).ColorIndex = xlAutomatic
End With
End Sub
Display More
Re: Colour Change Autoshape
Private Sub CommandButton1_Click()
Dim X As Integer
X = Range("H5").Value
With Sheets("Sheet 1").Shapes("Rectangle 1").Select
Select Case X
Case Is > 0:
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255,0,0)
Case Is < 0:
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(0,255,0)
Case Else:
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255,255,255)
End Select
End With
UserForm2.Hide
End Sub
Display More
Re: Colour Change Autoshape
have you got a sample sheet?
Re: Update Date On A Hidden Worksheet With Macro
yeah something like this for a named sheets will work fine...
Re: Listing All Part Number Combinations
Got ya...
Re: Listing All Part Number Combinations
i've inserted a concatemate formula into the spreadsheet to see if thats what you want to happen?
Re: Listing All Part Number Combinations
do you mean something of a permutation?
what i mean is. If the cell to the right has a value in it then take the left cells value and then concatenate(Join together) the two cells. Then if the cell to the right and one below has a value... take the same first cell and concatenate it with the cell right and below... ?
Re: Picture In A Picture
if the pictures already in the workbook you can control it with shapes, making a certain picture visible if the cell in sheet1 is red...
Re: For Each Worksheet
are you just converting any formula into values for column G?
Re: Opening Another Workbook
you need to add the directory in
Const MyDirLoad As String = "C:\blah\blah\blah\"
Public Function OpenWorkBook()
'Optional
'Application.ScreenUpdating = False
Dim myWB As Workbook
'this opens the file and sets an object variable to the opened file
Set myWB = Workbooks.Open(MyDirLoad & "Whatever" & ".xls")
'this runs the Auto_Open macro if there is one.
'Note that the above object variable is used in this statement
myWB.RunAutoMacros xlAutoOpen
'Application.ScreenUpdating = True
End Function
Display More