我在轴心中遇到问题:当我向A1号单元输入数据时,当我打入钥匙板时,数据应当放在另一张表格(表格)上,当我再次输入关于该电池的数据时,即A1号,该数据应当再在另一张表格(表格2)上复制,但在我打入时的下一行。 编码不好。
我尝试过你管治的外衣搜身的基本公式。 所有这些都不能解决我的问题。
我在轴心中遇到问题:当我向A1号单元输入数据时,当我打入钥匙板时,数据应当放在另一张表格(表格)上,当我再次输入关于该电池的数据时,即A1号,该数据应当再在另一张表格(表格2)上复制,但在我打入时的下一行。 编码不好。
我尝试过你管治的外衣搜身的基本公式。 所有这些都不能解决我的问题。
Sheet2
after entering 1,2,3,4 and 5
into cell A1
of Sheet1
.Sheet1
), the one where you will be entering the values.Sheet1(Sheet1)
, and the correct window will open.)... Sheet1 (Code)
: note that this Sheet1
refers to the Sheet1
on the left (in the Project Explorer) that is not in parentheses. It is the sheet s code name. The name in parentheses is the tab name (the one you see in Excel) and it could be different.Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Define constants.
Const SRC_CELL As String = "A1"
Const DST_SHEET As String = "Sheet2"
Const DST_FIRST_CELL As String = "A2"
Reference the source cell.
Dim sCell As Range: Set sCell = Me.Range(SRC_CELL)
Check if the source cell was not changed.
If Intersect(sCell, Target) Is Nothing Then Exit Sub
Reference the first destination cell.
Dim dCell As Range:
Set dCell = Me.Parent.Sheets(DST_SHEET).Range(DST_FIRST_CELL)
With dCell
Reference the destination range, the range starting from
the first destination cell to the last cell in the column
i.e. e.g. for A2 this means the range A2:A1048576 .
Dim drg As Range: Set drg = .Resize(Me.Rows.Count - .Row + 1)
Attempt to reference the last (bottom-most) non-empty cell
of the destination range.
Dim dlCell As Range:
Set dlCell = drg.Find("*", , xlFormulas, , , xlPrevious)
If the attempt was succesful i.e. there is a non-empty cell,...
If Not dlCell Is Nothing Then
... check if the last cell is not the last cell
of the destination range (there is no cell below it).
If dlCell.Row = Me.Rows.Count Then Exit Sub
Reference the cell below the last cell.
Set dCell = dlCell.Offset(1)
Else If the attempt failed i.e. all cells are empty,...
... do nothing i.e. use the already referenced destination cell.
End If
End With
Write the value from the source cell to the destination cell.
dCell.Value = sCell.Value
End Sub
For an Excel formula I need the first cell out of a list of cells which contains a numeric value: A | B | C | ... | Z | ----------------------------- | 0.1 | 0.4 | ... | =0.1 | | ...
I have a stored procedure that imports differently formatted workbooks into a database table, does work on them then drops the table. Here is the populating query. SELECT IDENTITY(INT,1,1) AS ID ...
The following code works. the connection opens fine but recordset.recordCount always returns -1 when there is data in the table. ANd If I try to call any methods/properties on recordset it crashes ...
I m using Application run to call several macros in order like this. Sub Run_All_Macros() Application.Run ("Macro_1") Application.Run ("Macro_1") End Sub When I start Run_All_Macros, all the ...
Does anyone know how to convert an Excel date to a correct Unix timestamp?
I am trying to import an excel file into a data table using GemBox and I keep getting this error: Invalid data value when extracting to DataTable at SourceRowIndex: 1, and SourceColumnIndex: 1. As ...
I am looking for any tips or resources on importing from excel into a SQL database, but specifically when the information is NOT in column and row format. I am currently doing some pre-development ...
I have created an Add-In in C# that implements user defined functions for Excel. These UDF s return immediately, but they control background asynchronous procedures. These procedures have status ...