Re: Conditional Formatting range of dates
[f]=and($b3<=today(),$c3>=today())[/f]
Re: Conditional Formatting range of dates
[f]=and($b3<=today(),$c3>=today())[/f]
Re: Seeking help to format data with a macro
Hi John, try it
Sub ertert()
Dim x, i As Long, j As Long, k As Long, bu As Boolean
With Range("A1").CurrentRegion
x = .Resize(.Rows.Count + 1).Value
For i = 1 To UBound(x, 1) - 1
k = k + 1
For j = 1 To UBound(x, 2)
x(k, j) = x(i, j)
Next j
Do While x(i, 5) = "C"
i = i + 1: bu = True
Loop
If bu Then
x(k, 3) = x(i - 1, 3): x(k, 4) = x(i - 1, 4)
x(k, 7) = x(i - 1, 7): bu = Not bu: i = i - 1
End If
Next i
.ClearContents: .Resize(k).Value = x
End With
End Sub
Display More
Re: Copying columns from two different workbooks into a new workbook
maybe something like
Sub copycellsover()
Dim strFirstFile$, strSecondFile$, strThirdFile$
Dim wbk As Workbook
strFirstFile = "I:\A.xls": strSecondFile = "I:\B.xls": strThirdFile = "I:\C.xls"
Set wbk = Workbooks.Open(strSecondFile) '"B.xls"
With Workbooks.Open(strFirstFile)
.Sheets("Report Tracking List").Range("A3:A65536").Copy wbk.Sheets("Sheet1").Range("A2")
.Close 0
End With
With Workbooks.Open(strThirdFile)
.Sheets("sheet1").Range("E8:E65536").Copy wbk.Sheets("Sheet1").Range("B2")
.Close 0
End With
'....................
End Sub
Display More
or
Sub copycellsover2()
Dim FirstArr, SecondArr
With GetObject("I:\A.xls")
With .Sheets("Report Tracking List")
FirstArr = .Range("A3", .Cells(Rows.Count, 1).End(xlUp)).Value
End With
.Close 0
End With
With GetObject("I:\C.xls")
With .Sheets("sheet1")
SecondArr = .Range("E8", .Cells(Rows.Count, 5).End(xlUp)).Value
End With
.Close 0
End With
'and here we compare FirstArr and SecondArr for differences
End Sub
Display More
Re: List all workbooks in a folder and all worksheets in each workbook
as an option (see attachment, save the file to disk before running the macro)
Re: Change backcolour of all userform comboboxes based on text selection
Hi Creativespace. Perhaps this example will help you.
Re: Program a button in Excel
Hi Sandra, try it
Private Sub CommandButton1_Click()
If Me.TextBox1.Value = vbNullString Then Exit Sub
Dim s$, t$
With Sheets("Data").Range("Names")
s = Join(WorksheetFunction.Transpose(.Value), "|")
t = Me.TextBox1.Value
If InStr(s, "|" & t) Then
MsgBox "The Name Already Exists", 64
Else
ThisWorkbook.Names("Names").RefersTo = .Resize(.Count + 1)
.Cells(.Count + 1).Value = t
End If
End With
End Sub
Display More
Re: Seeking help to format data with a macro
try it
Sub ertert()
Dim x, i As Long, j As Long, k As Long, bu As Boolean
With Range("A1:G" & Cells(Rows.Count, 1).End(xlUp).Row + 1)
x = .Value
For i = 1 To UBound(x, 1) - 1
k = k + 1
For j = 1 To UBound(x, 2)
x(k, j) = x(i, j)
Next j
Do While x(i, 5) = "C"
i = i + 1: bu = True
Loop
If bu Then
x(k, 3) = x(i - 1, 3): x(k, 4) = x(i - 1, 4)
x(k, 7) = x(i - 1, 7): bu = Not bu: i = i - 1
End If
Next i
.ClearContents: .Resize(k).Value = x
End With
End Sub
Display More
Re: Excel (2010) Macro to extract string between semi colons
Merrener, this solution is not suitable for you?
http://www.excelforum.com/exce…-between-semi-colons.html
Re: If Statements with Arrays
Hi Drow
The array formula such as =IF(A2:A10=A15,"Y","N"), returns an array of values.
Try to highlight a range in your example file, for instance, D2:D10, enter the formula =IF(A2:A10=A15,"Y","N") and press Ctrl+Shift+Enter. You will see the whole result array returned by the formula ('Y', 'N', 'N', etc.)
If you write our formula in a single cell, you can see only one (first) element of the result array returned by the formula (that is, you can see result of the comparison of only the first element of the array A2:A10 to cell A15).
Just for example: array formula =IF(SUM(--(B2:B10=B15)),"Y","N") returns a single value.
Re: If Statements with Arrays
try it
=IF(COUNTIF(A2:A10,A15)>0,"Y","N")
and
=IF(COUNTIF(B2:B10,B15)>0,"Y","N")
or just
=COUNTIF(B2:B10,B15)>0
Re: Transpose single column into multiple columns and rows
try it
Sub ertert()
Dim x, y(), i&, j&, k&
x = Range("A1:B" & Cells(Rows.Count, 1).End(xlUp).Row).Value
ReDim y(1 To UBound(x) / 6, 1 To 7)
For i = 1 To UBound(x) Step 6
k = k + 1
For j = 1 To 6
y(k, j) = x(i + j - 1, 1)
Next j
y(k, 7) = x(i, 2)
Next i
Range("E1:K1").Resize(k).Value = y()
End Sub
Display More