helpSample

G

Guest

i have been trying some samples with this:
http://www.contextures.com/xlUserForm01.html

and modified to this:


Option Explicit

Sub UpdateLogWorksheet()

Dim historyWks As Worksheet
Dim inputWks As Worksheet

Dim nextRow As Long
Dim oCol As Long

Dim myRng As Range
Dim myCopy As String
Dim myCell As Range

'cells to copy from Input sheet - some contain formulas
myCopy = "C3,C4,C5,D3,D4,D5,E3,E4,E5"

Set inputWks = Worksheets("MAIN")
Set historyWks = Worksheets("Data")

With historyWks
nextRow = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0).Row
End With

With inputWks
Set myRng = .Range(myCopy)

If Application.CountA(myRng) <> myRng.Cells.Count Then
MsgBox "Please fill in all the cells!"
Exit Sub
End If
End With

With historyWks
With .Cells(nextRow, "AM")
.Value = Now
.NumberFormat = "mm/dd/yyyy hh:mm:ss"
End With
.Cells(nextRow, "AN").Value = Application.UserName
oCol = 5
For Each myCell In myRng.Cells
historyWks.Cells(nextRow, oCol).Value = myCell.Value
oCol = oCol + 1
Next myCell
End With

'clear input cells that contain constants
With inputWks
On Error Resume Next
With .Range(myCopy).Cells.SpecialCells(xlCellTypeConstants)
.ClearContents
Application.GoTo .Cells(1) ', Scroll:=True
End With
On Error GoTo 0
End With
End Sub


I have some enquires:
1) can i modified so that users do not need to enter all cells. Those cells
without values will be save default as 0 value.
2) As my new enterly values will be save into col 5 (E), is it possible to
configure there will be auto-count no from col 1 to 4 (A to D). Like: 0 0 0
1, 0 0 0 2, 0 0 0 3... go on... to 0 0 1 0, 0 0 1 1, 0 0 1 2 to 9 9 9 9?

Thanks!
 
G

Guest

You have had a number of postings regarding this routine: it might be easier
if you send a copy of your w/book with explanation:

toppers <at>NOSPAMjohntopley.fsnet.co.uk

remove NOSAM
 
G

Guest

1) how do i add so that user should enter at least 1 cell?
2) u know i have a search engine, is it possible to search more than 1 data?
(example, we can have 3 same values for the 30 cells but different ABCD
values.)
 
G

Guest

1) how do i add so that user should enter at least 1 cell?
2) u know i have a search engine, is it possible to search more than 1 data?
(example, we can have 3 same values for the 30 cells but different ABCD
values.)
3) Is it possible to prevent adding number of values inside the 30cells.
Example (The CONCATENATE (AI) should not be the same).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Data Entry Form - Execute if value is not 0 5
Select sheet from cell value 9
Data Entry Form: Complex Example 4
Data Entry Form: Macro-One To Many 10
Data Entry Form 1
InsertFirst 12
help of VBA 1
modifyA 3

Top