LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default copy cell

thank you, with your help i changed the code and it works as i wanted.


"Ron de Bruin" wrote:

First I not see that you have Cells instead of Range in your code yesterday

I make the code a bit shorter
Try this with the value you want to copy on the activesheet

Sub Create()
Dim ws As Worksheet
Dim str As String
Dim Name As String

'no empty cell when generating ws
If Not IsEmpty(ActiveCell) Then
Name = ActiveCell.Value

str = ActiveSheet.Cells(ActiveCell.Row, 4).Value
Set ws = Worksheets.Add(After:=Sheets(Sheets.Count))

ws.Range("B5").Value = str

On Error Resume Next
ws.Name = Name
If Err.Number 0 Then
MsgBox "Change the name of : " & ws.Name & " manually"
Err.Clear
End If
On Error GoTo 0

End If
End Sub




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"raraschek" wrote in message ...
ok, thank you
---------------------------------
Sub Create()
Dim ws As Worksheet
Dim wsName As String, Name As String
Dim MsgError As String

MsgError = "Zadaný list už existuje! Vyberte bunku s iným listom. Potvrďte
End."

'no empty cell when generating ws
If Not IsEmpty(ActiveCell) Then
Name = ActiveCell.Value

Set ws = Worksheets.Add
ws.Move After:=Sheets(Sheets.Count)

'not to have two equal ws
Dim wks As Worksheet
For Each wks In ActiveWorkbook.Worksheets
If wks.Name = Name Then
MsgBox (MsgError)
End If
Next wks
ws.Name = Name

'new ws data and action

Dim wsCopyFrom As Worksheet
Set wsCopyFrom = Worksheets("mod")
Dim wsAS As Worksheet
Set wsAS = Worksheets("AS visit report")
Dim Msg As String
Dim datum As Range
Dim datumenter As Range

wsAS.Cells(ActiveCell.Row, 4).Copy
ws.Range("B5").PasteSpecial (xlPasteAll)

ws.Cells("B5").Value = wsAS.Cells(ActiveCell.Row, 4).Value

'end of creating ws

Msg = "Vložte údaje"
MsgBox (Msg)

End If
End Sub

"Ron de Bruin" wrote:

Post your complete code so we can see what you are trying to do

--






 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options Yuvraj Excel Discussion (Misc queries) 0 June 29th 09 11:20 AM
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Yuvraj Excel Discussion (Misc queries) 0 June 26th 09 06:01 PM
How can I copy a value from a cell and paste it into another cell while adding it to the previous value in that cell [email protected] Excel Worksheet Functions 2 November 7th 07 09:39 AM
I copy a formula and the results copy from the original cell brooklynsd Excel Discussion (Misc queries) 1 June 23rd 07 01:35 AM
VBA to copy to empty cell directly below a cell when analogous cells in different column have same value as each other? SROSENYC Excel Programming 1 August 5th 03 04:34 AM


All times are GMT +1. The time now is 12:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"