Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Urgent
Here is the code i want to copy data into selected range including i
checks.But my problem is selected area can not be pasted into selecte range. Sub CommandButton1_Click() i = 75 j = 74 Sheet6.Activate Sheet6.Range("C355:C706").Select Selection.Copy Sheet41.Select If IsEmpty(Sheet41.Cells(18, i)) Then Range(18, i).Select ActiveSheet.Paste Else k = i + 3 Range(18, k).Select ActiveSheet.Paste End If For j = 18 To 478 If IsEmpty(a = Sheet41.Cells(18, j)) Then vlookedup_column = j - 4 vlookup_column = j - 2 Set c = Sheet41.Cells(counter, vlookuped_column) Set d = Sheet41.Cells(counter, vlookup_column) If c < yes Then c.copy End If End If Nex -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Urgent
a few alterations.
i = 7 j = 7 Sheets("Sheet6").Activat Sheets("Sheet6").Range("C355:C706").Selec Selection.Cop Sheets("Sheet1").Selec If IsEmpty(Sheets("Sheet41").Cells(18, i)) The Cells(18, i).Selec ActiveSheet.Past Els k = i + Cells(18, k).Selec ActiveSheet.Past End I For j = 18 To 47 If IsEmpty(a = Sheets("Sheet41").Cells(18, j)) Then vlookedup_column = j - If IsEmpty(a = Sheets("Sheet41").Cells(18, j)) Then vlookup_column = j - Set c = Sheet41.Cells(counter, vlookuped_column Set d = Sheet41.Cells(counter, vlookup_column If c < yes The c.Cop End I Nex 'HTH |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Urgent
A number of problems,
You can't use Range(18, i).Select You need to use the cells property for using variable numbers Cells(18, i).Select (there are others) Also, you have a variable called vlookedup_column which you initialise with vlookedup_column = j - 4 and then use a completely different variable Set c = Sheet41.Cells(counter, vlookuped_column) which would be trapped by VBA if you declared your variables and used Option Explicit. And finally you have a loop For j = 18 To 478 If IsEmpty(a = Sheet41.Cells(18, j)) Then which lokks through columns 18 to 478. Problem is that there are only 256 columns, so it raises an error. Perhaps you mean 18 to 478 rows. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Hande Ozdayi " wrote in message ... Here is the code i want to copy data into selected range including if checks.But my problem is selected area can not be pasted into selected range. Sub CommandButton1_Click() i = 75 j = 74 Sheet6.Activate Sheet6.Range("C355:C706").Select Selection.Copy Sheet41.Select If IsEmpty(Sheet41.Cells(18, i)) Then Range(18, i).Select ActiveSheet.Paste Else k = i + 3 Range(18, k).Select ActiveSheet.Paste End If For j = 18 To 478 If IsEmpty(a = Sheet41.Cells(18, j)) Then vlookedup_column = j - 4 vlookup_column = j - 2 Set c = Sheet41.Cells(counter, vlookuped_column) Set d = Sheet41.Cells(counter, vlookup_column) If c < yes Then c.copy End If End If Next --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Please help me -urgent | Excel Worksheet Functions | |||
IME MODE FOR EXCEL 2007 (URGENT URGENT) | Excel Discussion (Misc queries) | |||
Urgent-Urgent VBA LOOP | Excel Discussion (Misc queries) | |||
Macro help urgent urgent | Excel Programming | |||
Macro help urgent urgent | Excel Programming |