I've got it solved:
Public ff, tt
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
Rows(ff).RowHeight = tt
ff = Target.Row
tt = Target.RowHeight
Target.EntireRow.AutoFit
End Sub
Thanks, handleman
As I run your codes, it says "Object variable or With block variable not set", it may points to OldSel.
I've tryed this kind of method before, set Oldsel as Target at end of program.
Sorry, I did not describe it clearly.
Like this:
I select C3, the 3rd row becames autofit, I can read the whole data in this row.
And then, I select D4, then the 3rd row will be back to its origin height, like 12.75, and the 4th row becames autofit.....
I've made the following to autofit the row of the cell I selected, but I want it to be the origin row height after another cell is selected.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Target.EntireRow.AutoFit
End Sub
Clyde38, Thanks for your chart.
handleman, I just can use VBA to write some functions which I can not get it from Excel. I don't know much about VBA. I made one like this:
Public Function VSearch(index1 As Variant, ar1 As Range, col1, col2 As Integer) As Variant
'to improve function of...
Is there anyway to get folders' name and file name into spreadsheet automaticly? like this.
MyDoc
Pics
Colleagues
Remond.jpg
Steve.jpg
Family
Friends
Memos
Kids
Lucy
Business
Meeting
There may be a file in Windows System, but I don't know which one.
Thank you IRStuff, that helps, but it seems not so convinent. If a cell is entered, is there a code we can use in VB?
I improved you marco,
Selection.NumberFormat = "m/d/yyyy h:mm"
Range("DateTime").Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _...
Like this:
PartNo PartStatus Qty Date & Time
123456 Received 200 2007-4-13 16:33
123457 Sent 100 2007-4-14 9:23
I want the "Date & Time" input automaticly. For example, as the time input the Qty.
I am creating a database which for inventory items stock. Is that possible to show the date and time in a cell of the same row where and when I input stock information?
Can a validation list in a cell is controled by another cell?
For example: if in cell "A1" is "Fruit", then the validation list in cell "B1" will be "Apple", "Pear", "Orange"; if in cell "A1" is "Furniture", the the calidation list in cell "B1" will be changed to "Table", "Chair", "Sofa".
I...