Re: Fill Array From Dynamic & Variable Range
Thanks PCI strange how we can complicate things.... much appreciated.
Re: Fill Array From Dynamic & Variable Range
Thanks PCI strange how we can complicate things.... much appreciated.
Hi
I was wondering why the following code does not produce an array. The message box display the proper format, but when I use UBound(myarray) it shows 0 it should read 4.
Any suggestion...
Sub test_array()
'A1="[email protected]"
'A2 ="[email protected]"
'A3 ="[email protected]"
'A4 ="[email protected]"
'A5="[email protected]"
rcount = Cells(Cells.Rows.Count, "a").End(xlUp).Row
For p = 1 To rcount
barray = Range("a" & p).Value
commma = ","
buildarray = buildarray + barray & commma & " "
Next p
longueur = Len(buildarray)
buildarray = Left(buildarray, (longueur - 2)) 'remove the last comma
MsgBox buildarray
'message box output = "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]"
myarray = Array(buildarray) '
maxval = UBound(myarray) '------> maxval =0 I am expected 4
End Sub
Display More
Re: Delete Row If Cell Text Matches Known String
Hi
I would try this code
Re: Cell Find
Thanks Sicarri your suggestion worked, but I am puzzle, because I did not provide the full code originally but if I would have you have seen this
date_format = Format(dateinf, "mm/dd/yyyy")
Cells.Find(What:=date_format, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Activate
and you would have seen this in my spreadsheet (see picture)
Re: Cell Find
Thanks Sicarri for your quick answer however if you look at the attached sample you will see 04/07/2008 any other suggestion?
Hi
I having trouble with a find function see attached sample. If I do it manually it will find it, but if try in a record macro i received a variable not set error.
I would appreciate any input
Thanks
Denis
Re: Error 1004 Error Handler
Quote from ReafidyPlease read this http://www.ozgrid.com/forum/showthread.php?t=74932
Try this:
a better way maybe to forget the error handler and use dir to check if the file exists. ie
Thanks your solution work perfectly resume line1:
Thanks for the fast response very much appreciated
Thanks for the suggestion (checking if the file exist), to be honest that suggestion never cross my mind
I need help on this one
I need to open 9 files in different worksheet. If the files is not present i want to get to the next available one. I don't understant the following code will work once, but not 2 times in arrow. The error handler routine works only once and then if the file is not present I will get a error 1004 (on this line Workbooks.Open Filename:="c:\" & openfile). I know that the file is not present but the error gets trap the first time and not the second time.
I what am I missing? Any help would appreciated.
Sub Main()
On Error GoTo ErrHandler
ReDim myfile(9) As String
Application.DisplayAlerts = False
myfile(1) = "DY01IPRB"
myfile(2) = "DY02IPRB"
myfile(3) = "ATDREXX1"
myfile(4) = "ATDREXX2"
myfile(5) = "ATDREXXW"
myfile(6) = "ATDUSER1"
myfile(7) = "ATDUSER2"
myfile(8) = "DY02BCH2"
myfile(9) = "R4ATD"
tdate = Format(Now(), "dd-mm-yyyy")
For i = 1 To 9
openfile = myfile(i) & "_" & tdate & ".csv"
'ntab = myfile(i) & "_" & tdate
'MsgBox openfile
ChDir "C:\"
Workbooks.Open Filename:="c:\" & openfile
'copy to template
ActiveSheet.UsedRange.Copy
ActiveWorkbook.Close
Sheets("Sommary-Sheet").Select
Sheets("Sommary-Sheet").Move After:=Sheets(10)
Sheets(i).Select
Cells.Select
Selection.Delete Shift:=xlUp
Range("a1").Select
ActiveSheet.Paste
'Sheets(i).Name = ntab
'Sheets(i).Name = myfile(i)
'Clean csv file
Call csvclean
Call highlightduplicate
Sheets("Sommary-Sheet").Select
line1:
Next
ErrHandler:
If Err.Number = 1004 Then
GoTo line1:
End If
End Sub
Display More
Re: Referencing A Field
Sub test()
'find last cell used in column A
rowcount = [A:IV]. Find("*", [A:IV].Item(1, 1), , , _
xlByRows, xlPrevious).Row
'go to the last cell
Range("A" & rowcount).Select
'take the address of the last cell
ende = ActiveCell.Address(rowabsolute, columnabsolute)
'from there you can use this reference (ende as the last range in column A)
End Sub
Re: Transpose Columns And Rows
Did you try copy and paste special (click on transpose)?
Hi
I have been trying to remove or disable the message on update to other worksheet " To update all linked click yes......"
I have try the following unsuccessfully
On the menu bar choose Edit ---> Links Can not choose manual, as the option is grey out (disable)
I would appreciate any help on this one, I would prefer a vba solution, but I am open to anything to get rid of this message
Thanks in advance
Denis
Re: Force A Date Format
Hi Roy
I thought the input could be changed with Worksheet_Change event. It does if the number are higher then 12, however the format does not change if the number are lower then 12. It appears that excel, will not make a difference if the number are lower then 12 (format wise).
Thanks
Denis
Re: Force A Date Format
Hi Roy
The problem is not with dates, it is the format (US, Canada and UK) have different date format. The purpose is to convert date to a standar regardless how it was entered.
Thanks
Denis
Re: Force A Date Format
Thanks Kenneth that was the problem disabling. Much appreciated.
Re: If Statement In Macro?
Try this
Private Sub Worksheet_Change(ByVal Target As Range)
Range("F1").Select
check_value = ActiveCell.Value
If check_value > 0.001 Then
Application.EnableEvents = False
Range("a1:g1").Select
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Range("c1").ClearContents
Range("a1").Select
Application.EnableEvents = True
Else
Range("a1:g1").Select
With Selection.Interior
.ColorIndex = 2
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Range("a1").Select
End If
End Sub
Display More
Re: Toggle Conditional Formatting
Would this help
Sub ShadeRows()
Dim iStart As Integer
Dim iEnd As Integer
Dim iStep As Integer, J As Integer
On Error GoTo line1
Range("A3:Q23").ClearFormats
shade_every_nrow = InputBox("Will shade every n row in the rows you select ie every second type 2")
iStep = shade_every_nrow 'Shade every 2th row
If shade_every_nrow = 0 Then
line1: Exit Sub
Else
Application.ScreenUpdating = False
iStart = 3
iEnd = [A:IV].Find("*", [A:IV].Item(1, 1), , , _
xlByRows, xlPrevious).Row
For J = iStart To iEnd Step iStep
Range("a" & J).Select
Range("A" & J & ":Q" & J).Interior.ColorIndex = 15
Next J
End If
Application.ScreenUpdating = True
End Sub
Display More