ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem Dropping data in first Empty Cell and across the row (https://www.excelbanter.com/excel-programming/318415-problem-dropping-data-first-empty-cell-across-row.html)

Ligaya

Problem Dropping data in first Empty Cell and across the row
 
Hi All,

I have spent all weekend trying to debug what's wrong with my code. I find
the first empty cell and dorp the current date and the other data across
current row. The problem I have is when I click the calc button again, it
drops the date but placed the other data on other rows.

Below is my code. I tried evrything. Does the formatting affect the rest
of the code Offset. It must be simple that I miss it.

Any help is great ly appreciated. Thanks.

Sub RXWaterLog() €˜Macro to start at Column 1 Row 3 find empty cell and add
data
Dim Today
Today = Now ' Assign current system date and time.
Dim MyCellCell As Range

With Worksheets("ICON Data Log")

If IsEmpty(.Cells(3, 1)) Then
Set MyCellCell = .Cells(3, 1)
ElseIf IsEmpty(.Cells(3 + 1, 1)) Then
Set MyCellCell = .Cells(3 + 1, 1)
Else


Set MyCellCell = .Cells(3, 1).End(xlDown).Offset(1, 0)
End If
MyCellValue = Today

End With

'System Data

ActiveCell.Offset(0, 1).Activate
ActiveCell.Value = " Water"

With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Locked = True
Selection.FormulaHidden = False
Selection.FormulaHidden = False


'Chromium

'With Workheets("ICON Data Log")
ActiveCell.Offset(0, 1).Activate
ActiveCell.Formula = "=IF(OR('Reactor Water'!F12=""Cr"",'Reactor
Water'!F13=""Cr""),LOOKUP(""B"",'Reactor Water'!F12:F13:'Reactor
Water'!G12:G13),0)"
'End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
'.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Locked = True
Selection.FormulaHidden = False'
End Sub



Ligaya















Sharad

Problem Dropping data in first Empty Cell and across the row
 

Hi,

1. 'MyCellValue = Today' ? Should it not be MyCellCell.Value = Today?

2. Further just after above line, add MyCellCell.Select
Because later you start with ActiveCell.Offset, so the activecell
should be MyCellCell. Therefore you first select it as above.

Sharad



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Ligaya

Problem Dropping data in first Empty Cell and across the row
 


"Sharad" wrote:


Hi,

1. 'MyCellValue = Today' ? Should it not be MyCellCell.Value = Today?

2. Further just after above line, add MyCellCell.Select
Because later you start with ActiveCell.Offset, so the activecell
should be MyCellCell. Therefore you first select it as above.

Sharad



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Sharad.

Thanks. I'll make corrections and run it again.

Regards.

Ligaya


All times are GMT +1. The time now is 10:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com