PDA

View Full Version : [SOLVED:] update status above tables



mokie
06-05-2017, 10:31 PM
Hello, I'd like to ask for new issue.
I have a files generate from database, like this on attachment.
Above every tables I have some character string like
"123456 AC 199 06.06.2017 05:30"
I need to cut last 16 strings
"06.06.2017 05:30"
And paste it to column "K" in those rows with the DATE (=10 string) in column A
Paste Nothing to "L"
If smg is exist on column "K" then paste it to "L"

Scope
Range - max 2000 rows A1:A2000

Thanks in advanced.

mdmackillop
06-06-2017, 02:08 AM
Ifsmg is exist on column "K" then paste it to "L"
What is smg?
Is the data to be posted as a string (as shown) or as date/time?

mokie
06-06-2017, 02:36 AM
Hello mdmackillop
About smg and other "***" in column L.
I'd like only show that the cell is empty or not. For sure, in those column it could be both situaction (text or data).


About data as string. Yes, I'd like as stiring (as shown).

Regards,
Mokie

mdmackillop
06-06-2017, 03:27 AM
Give this a try, based on your sample. The smg test may need changing as there is no clear indication of possible data types

Sub Test()
Dim r As Range, Data As String, c As Range
Set r = Range("A:A").SpecialCells(xlCellTypeConstants)
For Each c In r
c.Select
If c.Font.Bold Then
Data = Right(c, 17)
Else
If IsDate(c) Then
If IsNumeric(Left(c.Offset(, 10), 1)) Or c.Offset(, 10) = "" Then
c.Offset(, 10) = Data
Else
c.Offset(, 11) = Data
End If
End If
End If
Next c
End Sub

mokie
06-06-2017, 03:28 PM
Hello My bad;/ It works for example perfect. Thank You mdmackillop.
, but "123456 AC 199 06.06.2017 05:30" is on MergeArea.

We're working on ranges and loop For Each. How to change your code mdmackillop to read MergeArea?
Is that possilble to do without unmerged?:)




Range("A" & ActiveCell.Row).MergeArea(1)

Thanks in advance.
M

mokie
06-07-2017, 01:38 AM
Ok. I solved it :). Thanks again


With c
.MergeCells = True

c.Select
If c.Font.Bold And Len(c) > 24 then
(..)
end with