PC Review


Reply
 
 
bgkgmg
Guest
Posts: n/a
 
      1st Jul 2008
I would like to copy cells (after filling in) A4, B5, C6 and B3 into cells
F1, F2, F3 and F4 at the same time using a command button named Submit.
After copied I want original cells A4,B5,C6,B3 empty again. Please help.
Thanks
 
Reply With Quote
 
 
 
 
Susan
Guest
Posts: n/a
 
      1st Jul 2008
this works but is VERY clumsy....... there's got to be a better way,
probably using an array, but i don't know how to do it.
=======================
Option Explicit

Sub move()

Dim r1 As Range
Dim r2 As Range
Dim r3 As Range
Dim r4 As Range

Set r1 = ActiveSheet.Range("a4")
Set r2 = ActiveSheet.Range("b5")
Set r3 = ActiveSheet.Range("c6")
Set r4 = ActiveSheet.Range("b3")

ActiveSheet.Range("f1").Value = r1.Value
ActiveSheet.Range("f2").Value = r2.Value
ActiveSheet.Range("f3").Value = r3.Value
ActiveSheet.Range("f4").Value = r4.Value

r1.ClearContents
r2.ClearContents
r3.ClearContents
r4.ClearContents

End Sub
==================
hope somebody else posts with something better!

susan



On Jul 1, 12:46*pm, bgkgmg <bgk...@discussions.microsoft.com> wrote:
> I would like to copy cells (after filling in) A4, B5, C6 and B3 into cells
> F1, F2, F3 and F4 at the same time using a command button named Submit. *
> After copied I want original cells A4,B5,C6,B3 empty again. *Please help..
> Thanks


 
Reply With Quote
 
Kevin B
Guest
Posts: n/a
 
      1st Jul 2008
You could use this sub

Sub PickAndDrop()

Dim ws As Worksheet
Dim strSource(3) As String
Dim strTarget(3) As String
Dim i As Integer

Set ws = ThisWorkbook.ActiveSheet

strSource(0) = "A4"
strSource(1) = "B5"
strSource(2) = "C6"
strSource(3) = "B3"

strTarget(0) = "F1"
strTarget(1) = "F2"
strTarget(2) = "F3"
strTarget(3) = "F4"

For i = 0 To 3
ws.Range(strTarget(i)).Value = ws.Range(strSource(i)).Value
ws.Range(strSource(i)).Clear
Next i

Set ws = Nothing

End Sub

--
Kevin Backmann


"bgkgmg" wrote:

> I would like to copy cells (after filling in) A4, B5, C6 and B3 into cells
> F1, F2, F3 and F4 at the same time using a command button named Submit.
> After copied I want original cells A4,B5,C6,B3 empty again. Please help.
> Thanks

 
Reply With Quote
 
Alan
Guest
Posts: n/a
 
      1st Jul 2008
All you really need is this (if the Submit button is located on the same
sheet):

Private Sub Submit_Click()
Range("F1").Value = Range("A4").Value
Range("F2").Value = Range("B5").Value
Range("F3").Value = Range("C6").Value
Range("F4").Value = Range("B3").Value
Range("A4").Value = ""
Range("B5").Value = ""
Range("C6").Value = ""
Range("B3").Value = ""
End Sub


Alan



"bgkgmg" wrote:

> I would like to copy cells (after filling in) A4, B5, C6 and B3 into cells
> F1, F2, F3 and F4 at the same time using a command button named Submit.
> After copied I want original cells A4,B5,C6,B3 empty again. Please help.
> Thanks

 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      1st Jul 2008
Try this...

Dim X As Long
With Worksheets("Sheet3")
For X = 0 To 3
.Range(Array("F1", "F2", "F3", "F4")(X)).Value = _
.Range(Array("A4", "B5", "C6", "B3")(X)).Value
Next
.Range("A4,B5,C6,B3").Clear
End With

Rick


"bgkgmg" <(E-Mail Removed)> wrote in message
news:71786874-981C-469F-98E7-(E-Mail Removed)...
>I would like to copy cells (after filling in) A4, B5, C6 and B3 into cells
> F1, F2, F3 and F4 at the same time using a command button named Submit.
> After copied I want original cells A4,B5,C6,B3 empty again. Please help.
> Thanks


 
Reply With Quote
 
bgkgmg
Guest
Posts: n/a
 
      8th Jul 2008
In the 3 posts that worked they all were erased when I clicked the Submit
button again. I want the info to remain in cells F1-F4
Thanks

"bgkgmg" wrote:

> I would like to copy cells (after filling in) A4, B5, C6 and B3 into cells
> F1, F2, F3 and F4 at the same time using a command button named Submit.
> After copied I want original cells A4,B5,C6,B3 empty again. Please help.
> Thanks

 
Reply With Quote
 
HammerJoe@gmail.com
Guest
Posts: n/a
 
      9th Jul 2008
Try this:

Private Sub Submit_Click()
If Not IsEmpty(ThisWorkbook.Sheets(Range("A4").Value) then
Range("F1").Value = Range("A4").Value
If Not IsEmpty(ThisWorkbook.Sheets(Range("B5").Value) then
Range("F2").Value = Range("B5").Value
If Not IsEmpty(ThisWorkbook.Sheets(Range("C6").Value) then
Range("F3").Value = Range("C6").Value
If Not IsEmpty(ThisWorkbook.Sheets(Range("B3").Value) then
Range("F4").Value = Range("B3").Value
Range("A4").Value = ""
Range("B5").Value = ""
Range("C6").Value = ""
Range("B3").Value = ""
End Sub


On Jul 8, 1:38*am, bgkgmg <bgk...@discussions.microsoft.com> wrote:
> In the 3 posts that worked they all were erased when I clicked the Submit
> button again. *I want the info to remain in cells F1-F4
> Thanks
>
>
>
> "bgkgmg" wrote:
> > I would like to copy cells (after filling in) A4, B5, C6 and B3 into cells
> > F1, F2, F3 and F4 at the same time using a command button named Submit.*
> > After copied I want original cells A4,B5,C6,B3 empty again. *Please help.
> > Thanks


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reliably activate PowerPoint, do something, Activate Excel Barb Reinhardt Microsoft Excel Programming 1 4th Dec 2008 09:42 PM
Can't Activate - Clicking Activate Windows Does Nothing :( war59312 Windows Vista General Discussion 1 6th Mar 2007 07:31 AM
What's this? "Press spacebar to activate or enter to activate.... =?Utf-8?B?Rm9yU3VyZQ==?= Microsoft Outlook Discussion 3 13th Apr 2006 09:12 PM
Activate XP Home, then have to activate again after reboot Information Windows XP Basics 3 9th Feb 2006 12:21 AM
Workbook.Activate / Window.Activate problem Tim Microsoft Excel Programming 3 3rd Feb 2006 11:38 PM


Features
 

Advertising
 

Newsgroups
 


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