ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Keep Original Sheets Font Format when Populating data into other sheet (https://www.excelbanter.com/excel-programming/412089-keep-original-sheets-font-format-when-populating-data-into-other-sheet.html)

Corey ....[_2_]

Keep Original Sheets Font Format when Populating data into other sheet
 
Is use this sort of code to pupulate data from one sheet to the other:

With ActiveWorkbook.Worksheets("Sheet A")
..Select
Dim rngFound As Range
On Error Resume Next
' Gain the Location of the Combobox.Value
With Worksheets("Sheet B").Range("A:A")
Set rngFound = .Find(What:=Me.TextBox4.Value, After:=.Range("A1"),
LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, MatchCase:=False, Matchbyte:=False)
' Place Data
Range("O4").Value = TextBox4.Value
Range("O2").Value = rngFound.Offset(-1, 4).Value
Range("E2").Value = rngFound.Offset(-1, 2).Value
Range("E4").Value = rngFound.Offset(0, 2).Value



I want the Font Format to be AS IS from sheet1 to sheet2.

Some of the Fonts haver Font.Strikethrough, but when the data is copied to
the other sheet using the above code, the fonts are always normal.

How can i adapt the code to do this?
Is it possible to do this by a line of code, rather than changing each
(rngFound.offset(*,*)) line ?


Corey....



Jim Thomlinson

Keep Original Sheets Font Format when Populating data into other s
 
All you are doing is making one value equal to the other. you are not doing
anything to change the formats. To do that the easiest is to copy and paste
(or pastespecial if your found cells are formulas.). There is no easy one
liner as you would like...
--
HTH...

Jim Thomlinson


"Corey ...." wrote:

Is use this sort of code to pupulate data from one sheet to the other:

With ActiveWorkbook.Worksheets("Sheet A")
..Select
Dim rngFound As Range
On Error Resume Next
' Gain the Location of the Combobox.Value
With Worksheets("Sheet B").Range("A:A")
Set rngFound = .Find(What:=Me.TextBox4.Value, After:=.Range("A1"),
LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, MatchCase:=False, Matchbyte:=False)
' Place Data
Range("O4").Value = TextBox4.Value
Range("O2").Value = rngFound.Offset(-1, 4).Value
Range("E2").Value = rngFound.Offset(-1, 2).Value
Range("E4").Value = rngFound.Offset(0, 2).Value



I want the Font Format to be AS IS from sheet1 to sheet2.

Some of the Fonts haver Font.Strikethrough, but when the data is copied to
the other sheet using the above code, the fonts are always normal.

How can i adapt the code to do this?
Is it possible to do this by a line of code, rather than changing each
(rngFound.offset(*,*)) line ?


Corey....




Corey ....[_2_]

Keep Original Sheets Font Format when Populating data into other s
 
Jim,
thanks for ther reply.

So something like this:
rngFound.Offset(-1, 4).Copy
Range("O2").Paste

And do likewise to ALL cells?


"Jim Thomlinson" wrote in message
...
All you are doing is making one value equal to the other. you are not
doing
anything to change the formats. To do that the easiest is to copy and
paste
(or pastespecial if your found cells are formulas.). There is no easy one
liner as you would like...
--
HTH...

Jim Thomlinson


"Corey ...." wrote:

Is use this sort of code to pupulate data from one sheet to the other:

With ActiveWorkbook.Worksheets("Sheet A")
..Select
Dim rngFound As Range
On Error Resume Next
' Gain the Location of the Combobox.Value
With Worksheets("Sheet B").Range("A:A")
Set rngFound = .Find(What:=Me.TextBox4.Value, After:=.Range("A1"),
LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, MatchCase:=False, Matchbyte:=False)
' Place Data
Range("O4").Value = TextBox4.Value
Range("O2").Value = rngFound.Offset(-1, 4).Value
Range("E2").Value = rngFound.Offset(-1, 2).Value
Range("E4").Value = rngFound.Offset(0, 2).Value



I want the Font Format to be AS IS from sheet1 to sheet2.

Some of the Fonts haver Font.Strikethrough, but when the data is copied
to
the other sheet using the above code, the fonts are always normal.

How can i adapt the code to do this?
Is it possible to do this by a line of code, rather than changing each
(rngFound.offset(*,*)) line ?


Corey....







All times are GMT +1. The time now is 11:39 PM.

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